Fix recorder waiting when stream disabled
In the recorder, if the video or audio stream is disabled, do not wait for its initialization (it will never happen) to process the header. In that case (scrcpy --no-audio --record=file.mp4), this caused the whole content to be buffered in memory, and written only on exit.
This commit is contained in:
parent
379caf8551
commit
9d3c656414
1 changed files with 4 additions and 3 deletions
|
@ -178,9 +178,10 @@ static bool
|
||||||
sc_recorder_process_header(struct sc_recorder *recorder) {
|
sc_recorder_process_header(struct sc_recorder *recorder) {
|
||||||
sc_mutex_lock(&recorder->mutex);
|
sc_mutex_lock(&recorder->mutex);
|
||||||
|
|
||||||
while (!recorder->stopped && (!recorder->video_init
|
while (!recorder->stopped &&
|
||||||
|| !recorder->audio_init
|
((recorder->video && !recorder->video_init)
|
||||||
|| sc_recorder_has_empty_queues(recorder))) {
|
|| (recorder->audio && !recorder->audio_init)
|
||||||
|
|| sc_recorder_has_empty_queues(recorder))) {
|
||||||
sc_cond_wait(&recorder->cond, &recorder->mutex);
|
sc_cond_wait(&recorder->cond, &recorder->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue