diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-03-11 14:24:59 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-03-11 15:34:29 +0100 |
commit | ab4d49b6db06c3c03ef1e728b958014f1ef106d5 (patch) | |
tree | 01e24b936b3e1e4002225e65d4939a2f120db079 | |
parent | 552441c351caf9237f55f3754b4f96e9c29d4c00 (diff) | |
download | gstreamer-plugins-bad-ab4d49b6db06c3c03ef1e728b958014f1ef106d5.tar.gz |
atdec: Always try to pull one decoded frame out of the queue
... instead of doing magic calculations with the buffer duration.
-rw-r--r-- | sys/applemedia/atdec.c | 6 | ||||
-rw-r--r-- | 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 fae15c9e3..f4d1f3ddc 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 528490636..99945549d 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 |