stream_input: fixed some issues on stream_input. [1/1]
authorNanxin Qin <nanxin.qin@amlogic.com>
Mon, 18 May 2020 14:20:37 +0000 (22:20 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Thu, 21 May 2020 12:26:28 +0000 (05:26 -0700)
PD#SWPL-26251
PD#SWPL-26296
PD#SWPL-26188

Problem:
1. Cobalt encrypted video does not play,stream is played
   for many times,press CTRL +C to crash.
2. could not decode with audio only stream
3. Play PVR video,do FF,then quit FF,DUT auto stop play.

Solution:
1. psparser do not release more times.
2. the field is_phybuf can't set to wirte func.
3. should check vid and aid when the ts write.
4. the pts start before should check pid is valid.

Verify:
u212

Change-Id: I8fc4e5b176e6cd6fb2b839a2925003b59d1ca865
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
drivers/stream_input/amports/amstream.c
drivers/stream_input/parser/esparser.c
drivers/stream_input/parser/tsdemux.c

index 916a65654026a118c65d67bb57cbf74937c2fef7..c15c6a50f050b55ae08991235aa6b0b444a38c0b 100644 (file)
@@ -1057,8 +1057,10 @@ static int amstream_port_release(struct port_priv_s *priv)
                tsdemux_release();
        }
 
-       if (port->type & PORT_TYPE_MPPS)
+       if ((port->type & PORT_TYPE_MPPS) &&
+               !(port->flag & PORT_FLAG_VFORMAT)) {
                psparser_release();
+       }
 
        if (port->type & PORT_TYPE_VIDEO)
                video_port_release(priv, pvbuf, 0);
index 94fafd1824df5b7cf86e3504fba382f5afd3ae78..5b34e85522703d175a46bdbb9a6cc386950da8b3 100644 (file)
@@ -261,7 +261,6 @@ static ssize_t _esparser_write(const char __user *buf,
        return esparser_stbuf_write(stbuf, buf, count);
 }
 
-
 static ssize_t _esparser_write_s(const char __user *buf,
                        size_t count, struct stream_buf_s *stbuf)
 {
@@ -825,6 +824,7 @@ ssize_t drm_write(struct file *file, struct stream_buf_s *stbuf,
        len = realcount;
        count = realcount;
        totalcount = realcount;
+       stbuf->is_phybuf = isphybuf;
 
        while (len > 0) {
                if (stbuf->type != BUF_TYPE_SUBTITLE
index 9ba65b53569084d0dbac6e343816a0ca894e1a1a..0070724d44117b4e4d6d51e45fdfb86582f11b8b 100644 (file)
@@ -608,20 +608,24 @@ s32 tsdemux_init(u32 vid, u32 aid, u32 sid, u32 pcrid, bool is_hevc,
                        (7 << ES_SUB_WR_ENDIAN_BIT) | ES_SUB_MAN_RD_PTR);
 
        /* #if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
-       if (has_hevc_vdec())
-               r = pts_start((is_hevc) ? PTS_TYPE_HEVC : PTS_TYPE_VIDEO);
-       else
-               /* #endif */
-               r = pts_start(PTS_TYPE_VIDEO);
-
-       if (r < 0) {
-               pr_info("Video pts start failed.(%d)\n", r);
-               goto err1;
+       if (vid != 0xffff) {
+               if (has_hevc_vdec())
+                       r = pts_start((is_hevc) ? PTS_TYPE_HEVC : PTS_TYPE_VIDEO);
+               else
+                       /* #endif */
+                       r = pts_start(PTS_TYPE_VIDEO);
+               if ((r < 0) && (r != -EBUSY)) {
+                       pr_info("Video pts start failed.(%d)\n", r);
+                       goto err1;
+               }
        }
-       r = pts_start(PTS_TYPE_AUDIO);
-       if (r < 0) {
-               pr_info("Audio pts start failed.(%d)\n", r);
-               goto err2;
+
+       if (aid != 0xffff) {
+               r = pts_start(PTS_TYPE_AUDIO);
+               if ((r < 0) && (r != -EBUSY)) {
+                       pr_info("Audio pts start failed.(%d)\n", r);
+                       goto err2;
+               }
        }
        /*TODO irq */
 
@@ -761,8 +765,18 @@ static int limited_delay_check(struct file *file,
                struct stream_buf_s *abuf,
                const char __user *buf, size_t count)
 {
+       struct port_priv_s *priv = (struct port_priv_s *)file->private_data;
+       struct stream_port_s *port = priv->port;
        int write_size;
 
+       if (!((port->flag & PORT_FLAG_VID) &&
+               (port->flag & PORT_FLAG_AID))) {
+               struct stream_buf_s *buf =
+                       (port->flag & PORT_FLAG_VID) ? vbuf : abuf;
+
+               return min_t(int, count, stbuf_space(buf));
+       }
+
        if (vbuf->max_buffer_delay_ms > 0 && abuf->max_buffer_delay_ms > 0 &&
                stbuf_level(vbuf) > 1024 && stbuf_level(abuf) > 256) {
                int vdelay =
@@ -890,8 +904,16 @@ ssize_t drm_tswrite(struct file *file,
                        }
                }
 
-               write_size = min(stbuf_space(vbuf), stbuf_space(abuf));
-               write_size = min(count, write_size);
+               if ((port->flag & PORT_FLAG_VID) &&
+                       (port->flag & PORT_FLAG_AID)) {
+                       write_size = min(stbuf_space(vbuf), stbuf_space(abuf));
+                       write_size = min(count, write_size);
+               } else {
+                       struct stream_buf_s *buf =
+                               (port->flag & PORT_FLAG_VID) ? vbuf : abuf;
+
+                       write_size = min_t(int, count, stbuf_space(buf));
+               }
                /* pr_info("write_size = %d,count = %d,\n",*/
                   /*write_size, count); */
                if (write_size > 0)