[vlc-commits] access: rtp: flag discontinuity on TS sessions
Francois Cartegnie
git at videolan.org
Wed Sep 6 16:34:01 CEST 2017
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=7cffecf52b49f12c8261c3902eadc66f198b3687
---
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 *);
bool (*decode) (demux_t *, void *, block_t *);
uint32_t frequency; /* RTP clock rate (Hz) */
uint8_t number;
diff --git a/modules/access/rtp/session.c b/modules/access/rtp/session.c
index d0243e3d09..948cbaf0ed 100644
--- a/modules/access/rtp/session.c
+++ b/modules/access/rtp/session.c
@@ -124,6 +124,7 @@ int rtp_add_type (demux_t *demux, rtp_session_t *ses, const rtp_pt_t *pt)
ppt->init = pt->init ? pt->init : no_init;
ppt->destroy = pt->destroy ? pt->destroy : no_destroy;
ppt->decode = pt->decode ? pt->decode : no_decode;
+ ppt->header = NULL;
ppt->frequency = pt->frequency;
ppt->number = pt->number;
msg_Dbg (demux, "added payload type %"PRIu8" (f = %"PRIu32" Hz)",
@@ -518,6 +519,9 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
goto drop;
}
+ if(pt->header)
+ pt->header(demux, pt_data, block);
+
/* Computes the PTS from the RTP timestamp and payload RTP frequency.
* DTS is unknown. Also, while the clock frequency depends on the payload
* format, a single source MUST only use payloads of a chosen frequency.
More information about the vlc-commits
mailing list