author | Nanxin Qin <nanxin.qin@amlogic.com> | 2020-05-18 14:20:37 (GMT) |
---|---|---|
committer | Hui Zhang <hui.zhang@amlogic.com> | 2020-05-21 12:26:28 (GMT) |
commit | c51fd5a396b8f504e247fb6671a610a448dc141e (patch) | |
tree | 72c9408fa0b76ef9ad7415d2967edc3484feeb52 | |
parent | a0ffb8c688b56bd6df67539892010d0456b25b82 (diff) | |
download | media_modules-c51fd5a396b8f504e247fb6671a610a448dc141e.zip media_modules-c51fd5a396b8f504e247fb6671a610a448dc141e.tar.gz media_modules-c51fd5a396b8f504e247fb6671a610a448dc141e.tar.bz2 |
stream_input: fixed some issues on stream_input. [1/1]
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>
-rw-r--r-- | drivers/stream_input/amports/amstream.c | 4 | ||||
-rw-r--r-- | drivers/stream_input/parser/esparser.c | 2 | ||||
-rw-r--r-- | drivers/stream_input/parser/tsdemux.c | 52 |
3 files changed, 41 insertions, 17 deletions
diff --git a/drivers/stream_input/amports/amstream.c b/drivers/stream_input/amports/amstream.c index 916a656..c15c6a5 100644 --- a/drivers/stream_input/amports/amstream.c +++ b/drivers/stream_input/amports/amstream.c @@ -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); diff --git a/drivers/stream_input/parser/esparser.c b/drivers/stream_input/parser/esparser.c index 94fafd1..5b34e85 100644 --- a/drivers/stream_input/parser/esparser.c +++ b/drivers/stream_input/parser/esparser.c @@ -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 diff --git a/drivers/stream_input/parser/tsdemux.c b/drivers/stream_input/parser/tsdemux.c index 9ba65b5..0070724 100644 --- a/drivers/stream_input/parser/tsdemux.c +++ b/drivers/stream_input/parser/tsdemux.c @@ -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) |