tsync: tunnel mode do not set first vpts for stream mode [1/2]
authorshuanglong.wang <shuanglong.wang@amlogic.com>
Fri, 19 Jul 2019 02:48:07 +0000 (10:48 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Tue, 23 Jul 2019 01:29:33 +0000 (18:29 -0700)
PD#SWPL-11210

Problem:
stream mode set vpts in check in pts

Solution:
tunnel mode do not set first vpts for stream mode

Verify:
verify by u212

Change-Id: Ic369b83411051a819eb65ad5d1585e26e0342f3f
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
drivers/amlogic/media/frame_sync/ptsserv.c
drivers/amlogic/media/frame_sync/tsync.c
drivers/amlogic/media/video_sink/video.c
include/linux/amlogic/media/frame_sync/tsync.h
include/linux/amlogic/media/utils/amstream.h

index efe867c2d852966590514789f843bdff83cd7edb..615a408c59b0d33afdbd1ca3a71af48b71c2e6c7 100644 (file)
@@ -516,7 +516,7 @@ static int pts_checkin_offset_inline(u8 type, u32 offset, u32 val, u64 uS64)
                        if (tsync_get_debug_apts() && (type == PTS_TYPE_AUDIO))
                                pr_info("init apts[%d] at 0x%x\n", type, val);
 
-                       if (type == PTS_TYPE_VIDEO)
+                       if (type == PTS_TYPE_VIDEO && !tsync_get_tunnel_mode())
                                timestamp_vpts_set(val);
                        else if (type == PTS_TYPE_AUDIO)
                                timestamp_apts_set(val);
index 7e2f69108dd0a1c0d2d2146cea6b0f6335aeb7c3..5a66abd433eda92fa2e02e65a6f63b7851256095 100644 (file)
@@ -214,6 +214,7 @@ static int tsync_dec_reset_flag;
 static int tsync_dec_reset_video_start;
 static int tsync_automute_on;
 static int tsync_video_started;
+static int is_tunnel_mode;
 
 static int debug_pts_checkin;
 static int debug_pts_checkout;
@@ -1432,6 +1433,18 @@ int tsync_set_startsync_mode(int mode)
 }
 EXPORT_SYMBOL(tsync_set_startsync_mode);
 
+int tsync_set_tunnel_mode(int mode)
+{
+       return is_tunnel_mode = mode;
+}
+EXPORT_SYMBOL(tsync_set_tunnel_mode);
+
+int tsync_get_tunnel_mode(void)
+{
+       return is_tunnel_mode;
+}
+EXPORT_SYMBOL(tsync_get_tunnel_mode);
+
 bool tsync_check_vpts_discontinuity(unsigned int vpts)
 {
        unsigned int systemtime;
index b77c32083441f75ffc5783bb47712a88ddf3e45b..bf7e62da0bbc602074ae8118f0abaf1fd4781210 100644 (file)
@@ -9906,6 +9906,16 @@ static long amvideo_ioctl(struct file *file, unsigned int cmd, ulong arg)
                        break;
                }
 
+       case AMSTREAM_IOC_SET_TUNNEL_MODE: {
+               u32 tunnelmode = 0;
+
+               if (copy_from_user(&tunnelmode, argp, sizeof(u32)) == 0)
+                       tsync_set_tunnel_mode(tunnelmode);
+               else
+                       ret = -EFAULT;
+               break;
+       }
+
        case AMSTREAM_IOC_GET_FIRST_FRAME_TOGGLED:
                put_user(first_frame_toggled, (u32 __user *)argp);
                break;
@@ -10058,6 +10068,7 @@ static long amvideo_compat_ioctl(struct file *file, unsigned int cmd, ulong arg)
        case AMSTREAM_IOC_SET_VSYNC_UPINT:
        case AMSTREAM_IOC_SET_VSYNC_SLOW_FACTOR:
        case AMSTREAM_IOC_GLOBAL_SET_VIDEO_OUTPUT:
+       case AMSTREAM_IOC_SET_TUNNEL_MODE:
        case AMSTREAM_IOC_GET_FIRST_FRAME_TOGGLED:
        case AMSTREAM_IOC_SET_VIDEOPEEK:
                return amvideo_ioctl(file, cmd, arg);
index 0d0203ae8c1a94e55dc3099f9608fa891079e5d8..71b93169f769c05cba2b995073f1874db81008e7 100644 (file)
@@ -157,6 +157,10 @@ extern int tsync_set_av_threshold_max(int max);
 
 extern void set_pts_realign(void);
 
+extern int tsync_set_tunnel_mode(int mode);
+
+extern int tsync_get_tunnel_mode(void);
+
 extern void timestamp_set_pcrlatency(u32 latency);
 extern u32 timestamp_get_pcrlatency(void);
 extern bool tsync_check_vpts_discontinuity(unsigned int vpts);
index d2e36e054329d14ed3967d82c81d03e5006f70b5..faf13287d550b423d8adb444d2740e9b04ec5a34 100644 (file)
 #define AMSTREAM_IOC_GET_OMX_VERSION _IOW((_A_M), 0xb1, int)
 #define AMSTREAM_IOC_GET_OMX_INFO    _IOR((_A_M), 0xb2, unsigned int)
 #define AMSTREAM_IOC_SET_HDR_INFO    _IOW((_A_M), 0xb3, int)
+#define AMSTREAM_IOC_SET_TUNNEL_MODE _IOR(_A_M, 0xbd, unsigned int)
 #define AMSTREAM_IOC_GET_FIRST_FRAME_TOGGLED _IOR(_A_M, 0xbe, unsigned int)
 #define AMSTREAM_IOC_SET_VIDEOPEEK   _IOW(_A_M, 0xbf, unsigned int)