Display and control your Android device
Fix VPx recording
Romain Vimont58430b1c65d9
diff --git a/app/src/recorder.c b/app/src/recorder.cindex f6d5fe4c..5c5121b1 100644--- a/app/src/recorder.c+++ b/app/src/recorder.c@@ -181,7 +181,8 @@ sc_recorder_close_output_file(struct sc_recorder *recorder) {static inline boolsc_recorder_must_wait_for_config_packets(struct sc_recorder *recorder) {- if (recorder->video && sc_vecdeque_is_empty(&recorder->video_queue)) {+ if (recorder->video && recorder->video_expects_config_packet+ && sc_vecdeque_is_empty(&recorder->video_queue)) {// The video queue is emptyreturn true;}@@ -207,8 +208,8 @@ sc_recorder_process_header(struct sc_recorder *recorder) {sc_cond_wait(&recorder->cond, &recorder->mutex);}- if (recorder->video && sc_vecdeque_is_empty(&recorder->video_queue)) {- assert(recorder->stopped);+ if (recorder->stopped && recorder->video+ && sc_vecdeque_is_empty(&recorder->video_queue)) {// If the recorder is stopped, don't process anything if there are not// at least video packetssc_mutex_unlock(&recorder->mutex);@@ -217,7 +218,8 @@ sc_recorder_process_header(struct sc_recorder *recorder) {}AVPacket *video_pkt = NULL;- if (!sc_vecdeque_is_empty(&recorder->video_queue)) {+ if (recorder->video_expects_config_packet &&+ !sc_vecdeque_is_empty(&recorder->video_queue)) {assert(recorder->video);video_pkt = sc_vecdeque_pop(&recorder->video_queue);}@@ -579,6 +581,10 @@ sc_recorder_video_packet_sink_open(struct sc_packet_sink *sink,sc_orientation_get_name(recorder->orientation));}+ // A config packet is provided for all supported formats except VPx+ recorder->video_expects_config_packet = ctx->codec_id != AV_CODEC_ID_VP8+ && ctx->codec_id != AV_CODEC_ID_VP9;+recorder->video_init = true;sc_cond_signal(&recorder->cond);sc_mutex_unlock(&recorder->mutex);@@ -784,6 +790,7 @@ sc_recorder_init(struct sc_recorder *recorder, const char *filename,recorder->video_init = false;recorder->audio_init = false;+ recorder->video_expects_config_packet = false;recorder->audio_expects_config_packet = false;sc_recorder_stream_init(&recorder->video_stream);diff --git a/app/src/recorder.h b/app/src/recorder.hindex 70b73836..8638c72e 100644--- a/app/src/recorder.h+++ b/app/src/recorder.h@@ -53,6 +53,7 @@ struct sc_recorder {bool video_init;bool audio_init;+ bool video_expects_config_packet;bool audio_expects_config_packet;struct sc_recorder_stream video_stream;