mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
videodecoder: return NULL from _allocate_output_buffer() if alloc fails
.. instead of garbage pointer. Also log failure in debug log. Should've returned the flow return like _allocate_output_frame(). https://bugzilla.gnome.org/show_bug.cgi?id=683098
This commit is contained in:
parent
4834e11da0
commit
efff57d497
1 changed files with 13 additions and 2 deletions
|
@ -3032,11 +3032,16 @@ gst_video_decoder_negotiate (GstVideoDecoder * decoder)
|
|||
* Helper function that allocates a buffer to hold a video frame for @decoder's
|
||||
* current #GstVideoCodecState.
|
||||
*
|
||||
* Returns: (transfer full): allocated buffer
|
||||
* You should use gst_video_decoder_allocate_output_frame() instead of this
|
||||
* function, if possible at all.
|
||||
*
|
||||
* Returns: (transfer full): allocated buffer, or NULL if no buffer could be
|
||||
* allocated (e.g. when downstream is flushing or shutting down)
|
||||
*/
|
||||
GstBuffer *
|
||||
gst_video_decoder_allocate_output_buffer (GstVideoDecoder * decoder)
|
||||
{
|
||||
GstFlowReturn flow;
|
||||
GstBuffer *buffer;
|
||||
|
||||
GST_DEBUG ("alloc src buffer");
|
||||
|
@ -3047,10 +3052,16 @@ gst_video_decoder_allocate_output_buffer (GstVideoDecoder * decoder)
|
|||
&& gst_pad_check_reconfigure (decoder->srcpad))))
|
||||
gst_video_decoder_negotiate (decoder);
|
||||
|
||||
gst_buffer_pool_acquire_buffer (decoder->priv->pool, &buffer, NULL);
|
||||
flow = gst_buffer_pool_acquire_buffer (decoder->priv->pool, &buffer, NULL);
|
||||
|
||||
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
|
||||
|
||||
if (flow != GST_FLOW_OK) {
|
||||
GST_INFO_OBJECT (decoder, "couldn't allocate output buffer, flow %s",
|
||||
gst_flow_get_name (flow));
|
||||
buffer = NULL;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue