diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-11-11 11:15:35 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-11-11 11:18:40 +0100 |
commit | ce6222f8d405d147fd6ba321bdaeafd9b8f45ec3 (patch) | |
tree | a228eefd2bb217e6f880e3b18e9770dfd9bafb5e /gst/inter | |
parent | 3d1cd1011bd560862a351b61479eebc0601fe8b8 (diff) |
intervideosrc: Set the GAP flag on repeated buffers
videorate does the same and it allows optimizations downstream.
Diffstat (limited to 'gst/inter')
-rw-r--r-- | gst/inter/gstintervideosrc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gst/inter/gstintervideosrc.c b/gst/inter/gstintervideosrc.c index 10d6e297f..2a64f267f 100644 --- a/gst/inter/gstintervideosrc.c +++ b/gst/inter/gstintervideosrc.c @@ -308,6 +308,7 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size, GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src); GstCaps *caps; GstBuffer *buffer; + gboolean is_gap = FALSE; GST_DEBUG_OBJECT (intervideosrc, "create"); @@ -337,8 +338,18 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size, } if (intervideosrc->surface->video_buffer) { buffer = gst_buffer_ref (intervideosrc->surface->video_buffer); + + /* Repeated buffer? */ + if (intervideosrc->surface->video_buffer_count > 0) + is_gap = TRUE; + intervideosrc->surface->video_buffer_count++; if (intervideosrc->surface->video_buffer_count >= 30) { + /* The first black buffer is not a GAP anymore but + * the following are */ + if (intervideosrc->surface->video_buffer_count == 30) + is_gap = FALSE; + gst_buffer_unref (intervideosrc->surface->video_buffer); intervideosrc->surface->video_buffer = NULL; } @@ -413,6 +424,9 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size, buffer = gst_buffer_make_writable (buffer); + if (is_gap) + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_GAP); + GST_BUFFER_PTS (buffer) = intervideosrc->timestamp_offset + gst_util_uint64_scale (GST_SECOND * intervideosrc->n_frames, GST_VIDEO_INFO_FPS_D (&intervideosrc->info), |