summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-10-09 14:48:00 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:49:15 +0100
commit36df00b77317e42f3b09302cc513f6e833595f32 (patch)
treed7d2ede54e281d7a288fbefb30a5e5ce1127e948
parentc55cc71eaf8c16f3ec9f85a0173cef41639e18ae (diff)
decoder: refine semantics of gst_vaapi_decoder_put_buffer().
Improve the semantics for gst_vaapi_decoder_put_buffer() when an empty buffer is passed on. An empty buffer is a buffer with a NULL data pointer or with a size equals to zero. In this case, that buffer is simply skipped and the function returns TRUE. A NULL buffer argument still marks the end-of-stream.
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c
index 085b3e00..b8052d30 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder.c
@@ -389,7 +389,10 @@ gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder)
* Queues a #GstBuffer to the HW decoder. The decoder holds a
* reference to @buf.
*
- * Caller can notify an End-Of-Stream with @buf set to %NULL.
+ * Caller can notify an End-Of-Stream with @buf set to %NULL. However,
+ * if an empty buffer is passed, i.e. a buffer with %NULL data pointer
+ * or size equals to zero, then the function ignores this buffer and
+ * returns %TRUE.
*
* Return value: %TRUE on success
*/
@@ -398,7 +401,12 @@ gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf)
{
g_return_val_if_fail(GST_VAAPI_IS_DECODER(decoder), FALSE);
- return push_buffer(decoder, buf ? gst_buffer_ref(buf) : NULL);
+ if (buf) {
+ if (!GST_BUFFER_DATA(buf) || GST_BUFFER_SIZE(buf) <= 0)
+ return TRUE;
+ buf = gst_buffer_ref(buf);
+ }
+ return push_buffer(decoder, buf);
}
/**