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
@ -326,6 +326,7 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
guint64 frames;
|
||||||
gboolean is_gap = FALSE;
|
gboolean is_gap = FALSE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (intervideosrc, "create");
|
GST_DEBUG_OBJECT (intervideosrc, "create");
|
||||||
@ -333,6 +334,10 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||||||
caps = NULL;
|
caps = NULL;
|
||||||
buffer = 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);
|
g_mutex_lock (&intervideosrc->surface->mutex);
|
||||||
if (intervideosrc->surface->video_info.finfo) {
|
if (intervideosrc->surface->video_info.finfo) {
|
||||||
GstVideoInfo tmp_info = intervideosrc->surface->video_info;
|
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;
|
intervideosrc->n_frames = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intervideosrc->surface->video_buffer) {
|
if (intervideosrc->surface->video_buffer) {
|
||||||
guint64 frames = gst_util_uint64_scale_ceil (intervideosrc->timeout,
|
/* We have a buffer to push */
|
||||||
GST_VIDEO_INFO_FPS_N (&intervideosrc->info),
|
|
||||||
GST_VIDEO_INFO_FPS_D (&intervideosrc->info) * GST_SECOND);
|
|
||||||
|
|
||||||
buffer = gst_buffer_ref (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++;
|
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);
|
gst_buffer_unref (intervideosrc->surface->video_buffer);
|
||||||
intervideosrc->surface->video_buffer = NULL;
|
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);
|
g_mutex_unlock (&intervideosrc->surface->mutex);
|
||||||
|
|
||||||
if (caps) {
|
if (caps) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user