mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
atdec: Always try to pull one decoded frame out of the queue
... instead of doing magic calculations with the buffer duration.
This commit is contained in:
parent
41b2cca8fc
commit
8d8b3c0401
2 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -38,6 +38,7 @@ struct _GstATDec
|
|||
{
|
||||
GstAudioDecoder decoder;
|
||||
AudioQueueRef queue;
|
||||
gint spf;
|
||||
};
|
||||
|
||||
struct _GstATDecClass
|
||||
|
|
Loading…
Reference in a new issue