mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
atdec: First dequeue a buffer before enqueueing anything from the queue
Required for offline rendering according to the docs. wtf.
This commit is contained in:
parent
f331d3159f
commit
53ab9c6613
1 changed files with 31 additions and 1 deletions
|
@ -293,6 +293,8 @@ gst_atdec_set_format (GstAudioDecoder * decoder, GstCaps * caps)
|
|||
GstAudioInfo output_info = { 0 };
|
||||
AudioChannelLayout output_layout = { 0 };
|
||||
GstCaps *output_caps;
|
||||
AudioTimeStamp timestamp = { 0 };
|
||||
AudioQueueBufferRef output_buffer;
|
||||
GstATDec *atdec = GST_ATDEC (decoder);
|
||||
|
||||
GST_DEBUG_OBJECT (atdec, "set_format");
|
||||
|
@ -348,6 +350,21 @@ gst_atdec_set_format (GstAudioDecoder * decoder, GstCaps * caps)
|
|||
if (status)
|
||||
goto start_error;
|
||||
|
||||
timestamp.mFlags = kAudioTimeStampSampleTimeValid;
|
||||
timestamp.mSampleTime = 0;
|
||||
|
||||
status =
|
||||
AudioQueueAllocateBuffer (atdec->queue, atdec->spf * output_info.bpf,
|
||||
&output_buffer);
|
||||
if (status)
|
||||
goto allocate_output_error;
|
||||
|
||||
status = AudioQueueOfflineRender (atdec->queue, ×tamp, output_buffer, 0);
|
||||
if (status)
|
||||
goto offline_render_error;
|
||||
|
||||
AudioQueueFreeBuffer (atdec->queue, output_buffer);
|
||||
|
||||
return TRUE;
|
||||
|
||||
create_queue_error:
|
||||
|
@ -366,6 +383,19 @@ start_error:
|
|||
("AudioQueueStart returned error: %d", (gint) status));
|
||||
gst_atdec_destroy_queue (atdec, FALSE);
|
||||
return FALSE;
|
||||
|
||||
allocate_output_error:
|
||||
GST_ELEMENT_ERROR (atdec, STREAM, FORMAT, (NULL),
|
||||
("AudioQueueAllocateBuffer returned error: %d", (gint) status));
|
||||
gst_atdec_destroy_queue (atdec, FALSE);
|
||||
return FALSE;
|
||||
|
||||
offline_render_error:
|
||||
GST_ELEMENT_ERROR (atdec, STREAM, FORMAT, (NULL),
|
||||
("AudioQueueOfflineRender returned error: %d", (gint) status));
|
||||
AudioQueueFreeBuffer (atdec->queue, output_buffer);
|
||||
gst_atdec_destroy_queue (atdec, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -421,7 +451,7 @@ gst_atdec_handle_frame (GstAudioDecoder * decoder, GstBuffer * buffer)
|
|||
goto allocate_output_failed;
|
||||
|
||||
/* pull the frames */
|
||||
timestamp.kAudioTimeStampSampleTimeValid;
|
||||
timestamp.mFlags = kAudioTimeStampSampleTimeValid;
|
||||
timestamp.mSampleTime = atdec->output_position;
|
||||
status =
|
||||
AudioQueueOfflineRender (atdec->queue, ×tamp, output_buffer,
|
||||
|
|
Loading…
Reference in a new issue