[vlc-devel] [vlc-commits] access: rtp: flag discontinuity on TS sessions
Rémi Denis-Courmont
remi at remlab.net
Wed Sep 6 19:16:14 CEST 2017
Le keskiviikkona 6. syyskuuta 2017, 14.34.01 EEST Francois Cartegnie a écrit :
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 12
> 12:58:49 2017 +0200| [7cffecf52b49f12c8261c3902eadc66f198b3687] |
> committer: Francois Cartegnie
>
> access: rtp: flag discontinuity on TS sessions
>
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7cffecf52b49f12c826
> > 1c3902eadc66f198b3687
> ---
>
> modules/access/rtp/rtp.c | 12 ++++++++++++
> modules/access/rtp/rtp.h | 1 +
> modules/access/rtp/session.c | 4 ++++
> 3 files changed, 17 insertions(+)
>
> diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
> index 32ae0909da..c45df8e51a 100644
> --- a/modules/access/rtp/rtp.c
> +++ b/modules/access/rtp/rtp.c
> @@ -473,6 +473,16 @@ static void stream_destroy (demux_t *demux, void *data)
> }
> }
>
> +static void stream_header (demux_t *demux, void *data, block_t *block)
> +{
> + VLC_UNUSED(demux);
> + VLC_UNUSED(data);
> + if(block->p_buffer[1] & 0x80) /* TS M-bit == discontinuity (RFC 2250,
> 2.1) */ + {
> + block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
> + }
> +}
> +
> /* Send a packet to a chained demuxer */
> static bool stream_decode (demux_t *demux, void *data, block_t *block)
> {
> @@ -652,6 +662,7 @@ void rtp_autodetect (demux_t *demux, rtp_session_t
> *session, rtp_pt_t pt = {
> .init = NULL,
> .destroy = codec_destroy,
> + .header = NULL,
> .decode = codec_decode,
> .frequency = 0,
> .number = ptype,
> @@ -714,6 +725,7 @@ void rtp_autodetect (demux_t *demux, rtp_session_t
> *session, msg_Dbg (demux, "detected MPEG2 TS");
> pt.init = ts_init;
> pt.destroy = stream_destroy;
> + pt.header = stream_header;
> pt.decode = stream_decode;
> pt.frequency = 90000;
> break;
> diff --git a/modules/access/rtp/rtp.h b/modules/access/rtp/rtp.h
> index ae681fa390..ee57d7d322 100644
> --- a/modules/access/rtp/rtp.h
> +++ b/modules/access/rtp/rtp.h
> @@ -30,6 +30,7 @@ struct rtp_pt_t
> {
> void *(*init) (demux_t *);
> void (*destroy) (demux_t *, void *);
> + void (*header) (demux_t *, void *, block_t *);
In general, this would require passing per-block data via the per-session
opaque data, which is ugly, confusing and inefficient. If all you want is to
extract the M bit, it would be so much leaner to either add a private block
flag for it, or add a parameter to the depayloading callback.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list