Probe hardware rate transitions and clear stale call port commands
This commit is contained in:
1 parent
395a60360d
commit
b61ae3ff03
2 files changed
+15
-4
No files matched your search
@@ -141,7 +141,10 @@ int call_video_port_open(uint64_t id, const struct call_video_caps *caps) {
|
||||
pthread_mutex_lock(&lock);
|
||||
int result = schedule();
|
||||
if (!result) {
|
||||
if (port.id != id) { clear_frames(); port.status = (struct call_video_port_status){0}; }
|
||||
if (port.id != id) {
|
||||
clear_frames(); port.status = (struct call_video_port_status){0};
|
||||
port.configure = port.completed = port.resume = port.key = port.range = 0;
|
||||
}
|
||||
port.id = id; port.local = *caps; port.opening = 1;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "video port open requested call=%llu", (unsigned long long)id);
|
||||
}
|
||||
@@ -150,7 +153,8 @@ int call_video_port_open(uint64_t id, const struct call_video_caps *caps) {
|
||||
void call_video_port_close(uint64_t id) {
|
||||
pthread_mutex_lock(&lock);
|
||||
if (port.id == id) {
|
||||
clear_frames(); port.id = 0; port.opening = 1; port.configure = port.completed = 0;
|
||||
clear_frames(); port.id = 0; port.opening = 1;
|
||||
port.configure = port.completed = port.resume = port.key = port.range = 0;
|
||||
if (port.inst) schedule();
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "video port close requested call=%llu", (unsigned long long)id);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,16 @@ class CallVideoProbe : Instrumentation() {
|
||||
override fun onCreate(arguments: Bundle?) { super.onCreate(arguments); start() }
|
||||
override fun onStart() {
|
||||
try {
|
||||
val decoders = CallVideoCodec.probeDecoders()
|
||||
val codecs = CallVideoCodec.probe()
|
||||
check(codecs.isNotEmpty()) { "No conforming encoder/decoder pair" }
|
||||
finish(0, Bundle().apply { putString("codecs", codecs.toString()) })
|
||||
check(codecs.isNotEmpty() && decoders.isNotEmpty()) { "No verified encoders or decoders" }
|
||||
for ((codec, entry) in codecs) {
|
||||
val f = CallVideoFormat(1, 640, 480, codec = codec, level = entry.level, profile = entry.profile)
|
||||
for (rate in listOf(4_000_000, 300_000, 4_000_000)) {
|
||||
CallVideoCodec(f, rate, entry.name).use { it.prepare() }
|
||||
}
|
||||
}
|
||||
finish(0, Bundle().apply { putString("codecs", codecs.toString()); putString("decoders", decoders.toString()) })
|
||||
} catch (e: Exception) {
|
||||
android.util.Log.e("CallVideoProbe", "probe failed", e)
|
||||
finish(1, Bundle().apply { putString("error", e.toString()) })
|
||||
|
||||
Reference in new issue
Block a user