mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 08:41:07 +00:00
avauddec: Ensure drain even if codec has not delay capabilities
There are decoders that need to be drained if they work on multi-threads, even if AV_CODEC_CAP_DELAY is not set.
This commit is contained in:
parent
93e2466115
commit
472f2ef104
1 changed files with 10 additions and 19 deletions
|
@ -597,29 +597,20 @@ no_codec:
|
|||
static void
|
||||
gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec)
|
||||
{
|
||||
GstFFMpegAudDecClass *oclass;
|
||||
gboolean got_any_frames = FALSE;
|
||||
gboolean got_frame;
|
||||
|
||||
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
||||
if (avcodec_send_packet (ffmpegdec->context, NULL))
|
||||
goto send_packet_failed;
|
||||
|
||||
if (oclass->in_plugin->capabilities & AV_CODEC_CAP_DELAY) {
|
||||
gboolean got_frame;
|
||||
do {
|
||||
GstFlowReturn ret;
|
||||
|
||||
GST_LOG_OBJECT (ffmpegdec,
|
||||
"codec has delay capabilities, calling until libav has drained everything");
|
||||
|
||||
if (avcodec_send_packet (ffmpegdec->context, NULL))
|
||||
goto send_packet_failed;
|
||||
|
||||
do {
|
||||
GstFlowReturn ret;
|
||||
|
||||
got_frame = gst_ffmpegauddec_frame (ffmpegdec, &ret);
|
||||
if (got_frame)
|
||||
got_any_frames = TRUE;
|
||||
} while (got_frame);
|
||||
avcodec_flush_buffers (ffmpegdec->context);
|
||||
}
|
||||
got_frame = gst_ffmpegauddec_frame (ffmpegdec, &ret);
|
||||
if (got_frame)
|
||||
got_any_frames = TRUE;
|
||||
} while (got_frame);
|
||||
avcodec_flush_buffers (ffmpegdec->context);
|
||||
|
||||
if (got_any_frames)
|
||||
gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (ffmpegdec), NULL, 1);
|
||||
|
|
Loading…
Reference in a new issue