mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
intervideosrc: Fix GAP flag setting on black frames correctly
This did not actually work since the video_buffer was set to NULL after the first black frame. Reported by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
This commit is contained in:
parent
ec7f05dd9c
commit
825239b450
1 changed files with 16 additions and 15 deletions
|
@ -326,6 +326,7 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
GstCaps *caps;
|
||||
GstBuffer *buffer;
|
||||
guint64 frames;
|
||||
gboolean is_gap = FALSE;
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "create");
|
||||
|
@ -333,6 +334,10 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
caps = NULL;
|
||||
buffer = NULL;
|
||||
|
||||
frames = gst_util_uint64_scale_ceil (intervideosrc->timeout,
|
||||
GST_VIDEO_INFO_FPS_N (&intervideosrc->info),
|
||||
GST_VIDEO_INFO_FPS_D (&intervideosrc->info) * GST_SECOND);
|
||||
|
||||
g_mutex_lock (&intervideosrc->surface->mutex);
|
||||
if (intervideosrc->surface->video_info.finfo) {
|
||||
GstVideoInfo tmp_info = intervideosrc->surface->video_info;
|
||||
|
@ -354,29 +359,25 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
intervideosrc->n_frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (intervideosrc->surface->video_buffer) {
|
||||
guint64 frames = gst_util_uint64_scale_ceil (intervideosrc->timeout,
|
||||
GST_VIDEO_INFO_FPS_N (&intervideosrc->info),
|
||||
GST_VIDEO_INFO_FPS_D (&intervideosrc->info) * GST_SECOND);
|
||||
|
||||
/* We have a buffer to push */
|
||||
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->timeout > 0
|
||||
&& intervideosrc->surface->video_buffer_count >= frames) {
|
||||
/* The first black buffer is not a GAP anymore but
|
||||
* the following are */
|
||||
if (intervideosrc->surface->video_buffer_count == frames)
|
||||
is_gap = FALSE;
|
||||
|
||||
/* Can only be true if timeout > 0 */
|
||||
if (intervideosrc->surface->video_buffer_count >= frames) {
|
||||
gst_buffer_unref (intervideosrc->surface->video_buffer);
|
||||
intervideosrc->surface->video_buffer = NULL;
|
||||
}
|
||||
} else if (intervideosrc->surface->video_buffer_count == frames) {
|
||||
/* This will be our first black frame */
|
||||
intervideosrc->surface->video_buffer_count++;
|
||||
} else if (intervideosrc->surface->video_buffer_count > frames) {
|
||||
/* The first black buffer is not a GAP, but the following ones are */
|
||||
is_gap = TRUE;
|
||||
}
|
||||
|
||||
g_mutex_unlock (&intervideosrc->surface->mutex);
|
||||
|
||||
if (caps) {
|
||||
|
|
Loading…
Reference in a new issue