v4ldec: CB1 calc pts when pts=0 [1/1]
PD#SWPL-183734
Problem:
calc pts when pts=0 and interlace stream
Solution:
calc pts when pts=0 and interlace stream
Verify:
Yocto
Signed-off-by: le.han <le.han@amlogic.com>
Change-Id: Ie4da1ad55a72dd01387506538dedcc97b89969ba
diff --git a/src/gstamlv4l2videodec.c b/src/gstamlv4l2videodec.c
index baf95db..30a7862 100644
--- a/src/gstamlv4l2videodec.c
+++ b/src/gstamlv4l2videodec.c
@@ -123,8 +123,8 @@
#if GST_IMPORT_LGE_PROP
static void gst_aml_v4l2_video_dec_install_lge_properties_helper(GObjectClass *gobject_class);
#endif
-static GstClockTime calc_output_buffer_pts_func(GstAmlVideoDecoder *decoder);
-static GstClockTime calc_duration_func(GstAmlVideoDecoder *decoder);
+static GstClockTime gst_aml_v4l2_video_dec_calc_output_buffer_pts(GstAmlVideoDecoder *decoder);
+static GstClockTime gst_aml_v4l2_video_dec_calc_duration(GstAmlVideoDecoder *decoder);
static void
gst_aml_v4l2_video_dec_set_property(GObject *object,
@@ -987,7 +987,7 @@
}
static GstClockTime
-calc_output_buffer_pts_func(GstAmlVideoDecoder *decoder)
+gst_aml_v4l2_video_dec_calc_output_buffer_pts(GstAmlVideoDecoder *decoder)
{
GstAmlV4l2VideoDec *self = GST_AML_V4L2_VIDEO_DEC(decoder);
GstClockTime pts = GST_CLOCK_TIME_NONE;
@@ -1007,7 +1007,7 @@
}
static GstClockTime
-calc_duration_func(GstAmlVideoDecoder *decoder)
+gst_aml_v4l2_video_dec_calc_duration(GstAmlVideoDecoder *decoder)
{
GstAmlV4l2VideoDec *self = GST_AML_V4L2_VIDEO_DEC(decoder);
GstClockTime duration = GST_CLOCK_TIME_NONE;
@@ -1159,7 +1159,7 @@
goto activate_failed;
//cal duration when got resolution event
- self->frame_duration = calc_duration_func(decoder);
+ self->frame_duration = gst_aml_v4l2_video_dec_calc_duration(decoder);
g_mutex_lock(&self->res_chg_lock);
GST_LOG_OBJECT(decoder, "signal resolution changed");
@@ -1270,9 +1270,10 @@
if (ret != GST_FLOW_OK)
goto beach;
- if (!GST_BUFFER_PTS_IS_VALID (buffer))
+ if (!GST_BUFFER_PTS_IS_VALID (buffer)
+ || (GST_BUFFER_TIMESTAMP(buffer) == 0 && self->v4l2capture->info.interlace_mode == GST_VIDEO_INTERLACE_MODE_INTERLEAVED))
{
- GST_BUFFER_TIMESTAMP(buffer) = calc_output_buffer_pts_func(decoder);
+ GST_BUFFER_TIMESTAMP(buffer) = gst_aml_v4l2_video_dec_calc_output_buffer_pts(decoder);
}
if (self->v4l2capture->info.interlace_mode == GST_VIDEO_INTERLACE_MODE_INTERLEAVED)
@@ -1383,6 +1384,9 @@
if (G_UNLIKELY(!g_atomic_int_get(&self->active)))
goto flushing;
+ if (G_UNLIKELY(!GST_CLOCK_TIME_IS_VALID(self->frame_duration)))
+ self->frame_duration = frame->duration;
+
if (G_UNLIKELY(!GST_AML_V4L2_IS_ACTIVE(self->v4l2output)))
{
if (!self->input_state)