summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-04-29 19:42:18 +0200
committerJan Ekström <jeebjp@gmail.com>2018-05-03 01:08:44 +0300
commit0ab3184526e7b9b95c06a3ec7a6674283a5922d0 (patch)
tree4c05b192e65b51c68f3024b4b7946dcb79caf404 /player/audio.c
parent958053ff56109a38e9f8e0a0aa8786a5f47adb7c (diff)
downloadmpv-0ab3184526e7b9b95c06a3ec7a6674283a5922d0.tar.bz2
mpv-0ab3184526e7b9b95c06a3ec7a6674283a5922d0.tar.xz
encode: get rid of the output packet queue
Until recently, ao_lavc and vo_lavc started encoding whenever the core happened to send them data. Since audio and video are not initialized at the same time, and the muxer was not necessarily opened when the first encoder started to produce data, the resulting packets were put into a queue. As soon as the muxer was opened, the queue was flushed. Change this to make the core wait with sending data until all encoders are initialized. This has the advantage that we don't need to queue up the packets.
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/player/audio.c b/player/audio.c
index ce9e1cd06b..9b1340ec96 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -790,6 +790,10 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
if (mpctx->ao && ao_query_and_reset_events(mpctx->ao, AO_EVENT_RELOAD))
reload_audio_output(mpctx);
+ if (mpctx->ao && ao_query_and_reset_events(mpctx->ao,
+ AO_EVENT_INITIAL_UNBLOCK))
+ ao_unblock(mpctx->ao);
+
struct ao_chain *ao_c = mpctx->ao_chain;
if (!ao_c)
return;
@@ -811,6 +815,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
mpctx->audio_status = STATUS_EOF;
MP_VERBOSE(mpctx, "audio EOF without any data\n");
mp_filter_reset(ao_c->filter->f);
+ encode_lavc_stream_eof(mpctx->encode_lavc_ctx, STREAM_AUDIO);
}
return; // try again next iteration
}
@@ -994,6 +999,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
if (!was_eof) {
MP_VERBOSE(mpctx, "audio EOF reached\n");
mp_wakeup_core(mpctx);
+ encode_lavc_stream_eof(mpctx->encode_lavc_ctx, STREAM_AUDIO);
}
}
}