mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +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 */
|
/* configure input_format from caps */
|
||||||
gst_caps_to_at_format (caps, &input_format);
|
gst_caps_to_at_format (caps, &input_format);
|
||||||
|
/* Remember the number of samples per frame */
|
||||||
|
atdec->spf = input_format.mFramesPerPacket;
|
||||||
|
|
||||||
/* negotiate output caps */
|
/* negotiate output caps */
|
||||||
output_caps = gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (atdec));
|
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;
|
goto enqueue_buffer_failed;
|
||||||
|
|
||||||
/* figure out how many frames we need to pull out of the queue */
|
/* figure out how many frames we need to pull out of the queue */
|
||||||
out_frames = GST_CLOCK_TIME_TO_FRAMES (GST_BUFFER_DURATION (buffer),
|
size = atdec->spf * audio_info->bpf;
|
||||||
audio_info->rate);
|
|
||||||
size = out_frames * audio_info->bpf;
|
|
||||||
AudioQueueAllocateBuffer (atdec->queue, size, &output_buffer);
|
AudioQueueAllocateBuffer (atdec->queue, size, &output_buffer);
|
||||||
if (status)
|
if (status)
|
||||||
goto allocate_output_failed;
|
goto allocate_output_failed;
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct _GstATDec
|
||||||
{
|
{
|
||||||
GstAudioDecoder decoder;
|
GstAudioDecoder decoder;
|
||||||
AudioQueueRef queue;
|
AudioQueueRef queue;
|
||||||
|
gint spf;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstATDecClass
|
struct _GstATDecClass
|
||||||
|
|
Loading…
Reference in a new issue