From 8d8b3c04015201aaf08e2bcbc33913af81095698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 11 Mar 2014 14:24:59 +0100 Subject: [PATCH] atdec: Always try to pull one decoded frame out of the queue ... instead of doing magic calculations with the buffer duration. --- sys/applemedia/atdec.c | 6 +++--- sys/applemedia/atdec.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/applemedia/atdec.c b/sys/applemedia/atdec.c index fae15c9e39..f4d1f3ddc8 100644 --- a/sys/applemedia/atdec.c +++ b/sys/applemedia/atdec.c @@ -300,6 +300,8 @@ gst_atdec_set_format (GstAudioDecoder * decoder, GstCaps * caps) /* configure input_format from caps */ gst_caps_to_at_format (caps, &input_format); + /* Remember the number of samples per frame */ + atdec->spf = input_format.mFramesPerPacket; /* negotiate output caps */ output_caps = gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (atdec)); @@ -411,9 +413,7 @@ gst_atdec_handle_frame (GstAudioDecoder * decoder, GstBuffer * buffer) goto enqueue_buffer_failed; /* figure out how many frames we need to pull out of the queue */ - out_frames = GST_CLOCK_TIME_TO_FRAMES (GST_BUFFER_DURATION (buffer), - audio_info->rate); - size = out_frames * audio_info->bpf; + size = atdec->spf * audio_info->bpf; AudioQueueAllocateBuffer (atdec->queue, size, &output_buffer); if (status) goto allocate_output_failed; diff --git a/sys/applemedia/atdec.h b/sys/applemedia/atdec.h index 5284906367..99945549de 100644 --- a/sys/applemedia/atdec.h +++ b/sys/applemedia/atdec.h @@ -38,6 +38,7 @@ struct _GstATDec { GstAudioDecoder decoder; AudioQueueRef queue; + gint spf; }; struct _GstATDecClass