[vlc-commits] [Git][videolan/vlc][master] 9 commits: rtp: next sequence packet is in order
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Tue Nov 16 17:29:58 UTC 2021
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
0f809415 by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: next sequence packet is in order
max_seq is the *next* expected sequence number, not the last seen
sequence number. Consequently, a perfectly ordered packet will yield a
delta_seq difference of 0. It must be compared against the maximum
dropout, not the minimum negated misorder.
This fixes a regression from a8613e9b92db9a29b87ca81ef2ec12d8ec1f345a.
- - - - -
37cccb32 by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: add opaque and destroy to payload type
Some payload formats will eventually need private data and a mean to
release it, e.g. to save parameters from the SDP. Refs #26262.
- - - - -
cf5cf6de by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: improve documentation
- - - - -
fb6c0c3b by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: add vlc_rtp_es to abstract a PT output
- - - - -
1a6493a1 by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: add backends for ES and mux output
- - - - -
48f6c5bd by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: use vlc_rtp_es in payload format parsers
- - - - -
ff710069 by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: do not ignore G.711 channel count
- - - - -
c3a08c50 by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: ignore MPEG Audio channel count
The correct value is determined by the packetizer. The SDP value is
normally missing.
- - - - -
255c27e6 by Rémi Denis-Courmont at 2021-11-16T17:07:38+00:00
rtp: rationalise PT callback types
- - - - -
5 changed files:
- modules/access/rtp/rtp.c
- modules/access/rtp/rtp.h
- modules/access/rtp/rtpfmt.c
- modules/access/rtp/session.c
- modules/access/rtp/xiph.c
Changes:
=====================================
modules/access/rtp/rtp.c
=====================================
@@ -57,6 +57,95 @@
# define IPPROTO_UDPLITE 136 /* from IANA */
#endif
+struct vlc_rtp_es_id {
+ struct vlc_rtp_es es;
+ es_out_t *out;
+ es_out_id_t *id;
+};
+
+static void vlc_rtp_es_id_destroy(struct vlc_rtp_es *es)
+{
+ struct vlc_rtp_es_id *ei = container_of(es, struct vlc_rtp_es_id, es);
+
+ es_out_Del(ei->out, ei->id);
+ free(ei);
+}
+
+static void vlc_rtp_es_id_send(struct vlc_rtp_es *es, block_t *block)
+{
+ struct vlc_rtp_es_id *ei = container_of(es, struct vlc_rtp_es_id, es);
+
+ /* TODO: Don't set PCR here. Breaks multiple sources (in a session)
+ * and more importantly eventually multiple sessions. */
+ es_out_SetPCR(ei->out, block->i_pts);
+ es_out_Send(ei->out, ei->id, block);
+}
+
+static const struct vlc_rtp_es_operations vlc_rtp_es_id_ops = {
+ vlc_rtp_es_id_destroy, vlc_rtp_es_id_send,
+};
+
+struct vlc_rtp_es *vlc_rtp_es_request(void *data,
+ const es_format_t *restrict fmt)
+{
+ demux_t *demux = data;
+
+ struct vlc_rtp_es_id *ei = malloc(sizeof (*ei));
+ if (unlikely(ei == NULL))
+ return vlc_rtp_es_dummy;
+
+ ei->es.ops = &vlc_rtp_es_id_ops;
+ ei->out = demux->out;
+ ei->id = es_out_Add(demux->out, fmt);
+ if (ei->id == NULL) {
+ free(ei);
+ return NULL;
+ }
+ return &ei->es;
+}
+
+struct vlc_rtp_es_mux {
+ struct vlc_rtp_es es;
+ vlc_demux_chained_t *chained_demux;
+};
+
+static void vlc_rtp_es_mux_destroy(struct vlc_rtp_es *es)
+{
+ struct vlc_rtp_es_mux *em = container_of(es, struct vlc_rtp_es_mux, es);
+
+ vlc_demux_chained_Delete(em->chained_demux);
+ free(em);
+}
+
+static void vlc_rtp_es_mux_send(struct vlc_rtp_es *es, block_t *block)
+{
+ struct vlc_rtp_es_mux *em = container_of(es, struct vlc_rtp_es_mux, es);
+
+ vlc_demux_chained_Send(em->chained_demux, block);
+}
+
+static const struct vlc_rtp_es_operations vlc_rtp_es_mux_ops = {
+ vlc_rtp_es_mux_destroy, vlc_rtp_es_mux_send,
+};
+
+struct vlc_rtp_es *vlc_rtp_mux_request(void *data, const char *name)
+{
+ demux_t *demux = data;
+
+ struct vlc_rtp_es_mux *em = malloc(sizeof (*em));
+ if (unlikely(em == NULL))
+ return vlc_rtp_es_dummy;
+
+ em->es.ops = &vlc_rtp_es_mux_ops;
+ em->chained_demux = vlc_demux_chained_New(VLC_OBJECT(demux), name,
+ demux->out);
+ if (em->chained_demux == NULL) {
+ free(em);
+ return NULL;
+ }
+ return &em->es;
+}
+
/**
* Extracts port number from "[host]:port" or "host:port" strings,
* and remove brackets from the host name.
=====================================
modules/access/rtp/rtp.h
=====================================
@@ -20,34 +20,104 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
+/**
+ * \defgroup rtp RTP
+ * Real-time Transport Protocol
+ * \ingroup net
+ *
+ * @{
+ * \file
+ */
+
typedef struct vlc_rtp_pt rtp_pt_t;
typedef struct rtp_session_t rtp_session_t;
struct vlc_demux_chained_t;
struct vlc_sdp_media;
-/** @section RTP payload format */
+/**
+ * \defgroup rtp_pt RTP payload format
+ * @{
+ */
+/**
+ * Payload type mapping.
+ *
+ * This structure represents a mapping for an RTP payload format
+ * extracted from an \ref sdp description.
+ */
struct vlc_sdp_pt {
- const struct vlc_sdp_media *media;
- char name[16];
- unsigned int clock_rate;
- unsigned char channel_count;
- const char *parameters;
+ const struct vlc_sdp_media *media; /**< Containant SDP media description */
+ char name[16]; /**< RTP payload format name, i.e. MIME subtype */
+ unsigned int clock_rate; /**< RTP clock rate (in Hertz) */
+ unsigned char channel_count; /**< Number of channels (0 if unspecified) */
+ const char *parameters; /**< Format parameters from the a=fmtp line */
};
+/**
+ * RTP payload format operations.
+ *
+ * This structures contains the callbacks provided by an RTP payload format.
+ */
struct vlc_rtp_pt_operations {
- void *(*init)(struct vlc_rtp_pt *, demux_t *);
- void (*destroy)(demux_t *, void *);
- void (*decode)(demux_t *, void *, block_t *);
+ /**
+ * Releases the payload format.
+ *
+ * This optional callback releases any resources associated with the
+ * payload format, such as copies of the payload format parameters.
+ *
+ * \param pt RTP payload format that is being released
+ */
+ void (*release)(struct vlc_rtp_pt *pt);
+
+ /**
+ * Starts using a payload format.
+ *
+ * This required callback initialises per-source resources for the payload
+ * format, such as an elementary stream output.
+ *
+ * \note There may be multiple RTP sources using the same payload format
+ * concurrently within single given RTP session. This callback is invoked
+ * for each source.
+ *
+ * \param pt RTP payload format being taken into use
+ * \return a data pointer for decode() and destroy() callbacks
+ */
+ void *(*init)(struct vlc_rtp_pt *pt, demux_t *);
+
+ /**
+ * Stops using a payload format.
+ *
+ * This optional callback deinitialises per-source resources.
+ *
+ * \param pt RTP payload format to relinquish
+ * \param data data pointer returned by init()
+ */
+ void (*destroy)(struct vlc_rtp_pt *pt, void *data);
+
+ /**
+ * Processes a data payload.
+ *
+ * \param pt RTP payload format of the payload
+ * \param data data pointer returned by init()
+ * \param block payload of a received RTP packet
+ */
+ void (*decode)(struct vlc_rtp_pt *pt, void *data, block_t *block);
};
+/**
+ * RTP payload format.
+ *
+ * This structures represents a payload format within an RTP session
+ * (\ref vlc_rtp_session_t).
+ */
struct vlc_rtp_pt
{
- const struct vlc_rtp_pt_operations *ops;
- uint32_t frequency; /* RTP clock rate (Hz) */
- uint8_t number;
- uint8_t channel_count;
+ const struct vlc_rtp_pt_operations *ops; /**< Payload format callbacks */
+ void *opaque; /**< Private data pointer */
+ uint32_t frequency; /**< RTP clock rate (Hz) */
+ uint8_t number; /**< RTP payload type number within the session (0-127) */
+ uint8_t channel_count; /**< Channel count (zero if unspecified) */
};
/**
@@ -79,14 +149,12 @@ static inline void *vlc_rtp_pt_begin(struct vlc_rtp_pt *pt, demux_t *demux)
* This destroys an instance of a payload type created by vlc_rtp_pt_begin().
*
* @param pt RTP payload type to deinstantiate
- * @param demux demux object that was used by the instance
* @param data instance private data as returned by vlc_rtp_pt_begin()
*/
-static inline void vlc_rtp_pt_end(struct vlc_rtp_pt *pt, demux_t *demux,
- void *data)
+static inline void vlc_rtp_pt_end(struct vlc_rtp_pt *pt, void *data)
{
if (pt->ops->destroy != NULL)
- pt->ops->destroy(demux, data);
+ pt->ops->destroy(pt, data);
}
/**
@@ -95,14 +163,65 @@ static inline void vlc_rtp_pt_end(struct vlc_rtp_pt *pt, demux_t *demux,
* This passes a data payload of an RTP packet to the instance of the
* payload type specified in the packet (PT and SSRC fields).
*/
-static inline void vlc_rtp_pt_decode(const struct vlc_rtp_pt *pt,
- demux_t *demux,
+static inline void vlc_rtp_pt_decode(struct vlc_rtp_pt *pt,
void *data, block_t *pkt)
{
assert(pt->ops->decode != NULL);
- pt->ops->decode(demux, data, pkt);
+ pt->ops->decode(pt, data, pkt);
+}
+
+struct vlc_rtp_es;
+
+/**
+ * RTP elementary output stream operations.
+ */
+struct vlc_rtp_es_operations {
+ void (*destroy)(struct vlc_rtp_es *es);
+ void (*send)(struct vlc_rtp_es *es, block_t *block);
+};
+
+/**
+ * RTP elementary output stream.
+ *
+ * This structure represents a data sink for an active instance of a payload
+ * format, typically an output elementary stream (ES) \ref es_out_id_t.
+ */
+struct vlc_rtp_es {
+ const struct vlc_rtp_es_operations *ops;
+};
+
+/**
+ * Destroys an \ref vlc_rtp_es.
+ *
+ * \param es object to release
+ */
+static inline void vlc_rtp_es_destroy(struct vlc_rtp_es *es)
+{
+ assert(es->ops->destroy != NULL);
+ es->ops->destroy(es);
}
+/**
+ * Sends coded data for output.
+ *
+ * \param es output stream to send the data to
+ * \param block data block to process
+ */
+static inline void vlc_rtp_es_send(struct vlc_rtp_es *es, block_t *block)
+{
+ assert(es->ops->send != NULL);
+ es->ops->send(es, block);
+}
+
+/**
+ * A dummy output that discards data.
+ */
+extern struct vlc_rtp_es *const vlc_rtp_es_dummy;
+
+struct vlc_rtp_es *vlc_rtp_es_request(void *, const es_format_t *fmt);
+struct vlc_rtp_es *vlc_rtp_mux_request(void *, const char *name);
+
+
void rtp_autodetect(vlc_object_t *, rtp_session_t *, const block_t *);
static inline uint8_t rtp_ptype (const block_t *block)
@@ -110,13 +229,14 @@ static inline uint8_t rtp_ptype (const block_t *block)
return block->p_buffer[1] & 0x7F;
}
-void *codec_init (demux_t *demux, es_format_t *fmt);
-void codec_destroy (demux_t *demux, void *data);
-void codec_decode (demux_t *demux, void *data, block_t *block);
-
extern const struct vlc_rtp_pt_operations rtp_video_theora;
-/** @section RTP session */
+/** @} */
+
+/**
+ * \defgroup rtp_session RTP session
+ * @{
+ */
rtp_session_t *rtp_session_create (demux_t *);
void rtp_session_destroy (demux_t *, rtp_session_t *);
void rtp_queue (demux_t *, rtp_session_t *, block_t *);
@@ -127,6 +247,9 @@ int vlc_rtp_add_media_types(vlc_object_t *obj, rtp_session_t *ses,
void *rtp_dgram_thread (void *data);
+/** @} */
+/** @} */
+
/* Global data */
typedef struct
{
=====================================
modules/access/rtp/rtpfmt.c
=====================================
@@ -39,62 +39,18 @@
* Generic packet handlers
*/
-void *codec_init (demux_t *demux, es_format_t *fmt)
+static void codec_destroy(struct vlc_rtp_pt *pt, void *data)
{
- if (fmt->i_cat == AUDIO_ES)
- aout_FormatPrepare (&fmt->audio);
- return es_out_Add (demux->out, fmt);
-}
-
-void codec_destroy (demux_t *demux, void *data)
-{
- if (data)
- es_out_Del (demux->out, (es_out_id_t *)data);
-}
-
-/* Send a packet to decoder */
-void codec_decode (demux_t *demux, void *data, block_t *block)
-{
- if (data)
- {
- block->i_dts = VLC_TICK_INVALID; /* RTP does not specify this */
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, (es_out_id_t *)data, block);
- }
- else
- block_Release (block);
-}
-
-static void *stream_init (demux_t *demux, const char *name)
-{
- demux_sys_t *p_sys = demux->p_sys;
-
- if (p_sys->chained_demux != NULL)
- return NULL;
- p_sys->chained_demux = vlc_demux_chained_New(VLC_OBJECT(demux), name,
- demux->out);
- return p_sys->chained_demux;
-}
-
-static void stream_destroy (demux_t *demux, void *data)
-{
- demux_sys_t *p_sys = demux->p_sys;
-
- if (data)
- {
- vlc_demux_chained_Delete(data);
- p_sys->chained_demux = NULL;
- }
+ (void) pt;
+ vlc_rtp_es_destroy(data);
}
-/* Send a packet to a chained demuxer */
-static void stream_decode (demux_t *demux, void *data, block_t *block)
+/* Send a packet to ES */
+static void codec_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
- if (data)
- vlc_demux_chained_Send(data, block);
- else
- block_Release (block);
- (void)demux;
+ (void) pt;
+ block->i_dts = VLC_TICK_INVALID;
+ vlc_rtp_es_send(data, block);
}
/*
@@ -110,12 +66,12 @@ static void *pcmu_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MULAW);
fmt.audio.i_rate = pt->frequency;
- fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
- return codec_init (demux, &fmt);
+ fmt.audio.i_channels = pt->channel_count ? pt->channel_count : 1;
+ return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_pcmu = {
- pcmu_init, codec_destroy, codec_decode,
+ NULL, pcmu_init, codec_destroy, codec_decode,
};
/* PT=3
@@ -129,11 +85,11 @@ static void *gsm_init(struct vlc_rtp_pt *pt, demux_t *demux)
fmt.audio.i_rate = 8000;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
(void) pt;
- return codec_init (demux, &fmt);
+ return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_gsm = {
- gsm_init, codec_destroy, codec_decode,
+ NULL, gsm_init, codec_destroy, codec_decode,
};
/* PT=8
@@ -145,12 +101,12 @@ static void *pcma_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_ALAW);
fmt.audio.i_rate = pt->frequency;
- fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
- return codec_init (demux, &fmt);
+ fmt.audio.i_channels = pt->channel_count ? pt->channel_count : 1;
+ return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_pcma = {
- pcma_init, codec_destroy, codec_decode,
+ NULL, pcma_init, codec_destroy, codec_decode,
};
/* PT=10,11
@@ -163,11 +119,11 @@ static void *l16_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = pt->frequency;
fmt.audio.i_channels = pt->channel_count ? pt->channel_count : 1;
- return codec_init (demux, &fmt);
+ return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_l16 = {
- l16_init, codec_destroy, codec_decode,
+ NULL, l16_init, codec_destroy, codec_decode,
};
/* PT=12
@@ -181,11 +137,11 @@ static void *qcelp_init(struct vlc_rtp_pt *pt, demux_t *demux)
fmt.audio.i_rate = 8000;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
(void) pt;
- return codec_init (demux, &fmt);
+ return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_qcelp = {
- qcelp_init, codec_destroy, codec_decode,
+ NULL, qcelp_init, codec_destroy, codec_decode,
};
/* PT=14
@@ -196,13 +152,12 @@ static void *mpa_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
- fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.b_packetized = false;
(void) pt;
- return codec_init (demux, &fmt);
+ return vlc_rtp_es_request(demux, &fmt);
}
-static void mpa_decode (demux_t *demux, void *data, block_t *block)
+static void mpa_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
if (block->i_buffer < 4)
{
@@ -212,12 +167,13 @@ static void mpa_decode (demux_t *demux, void *data, block_t *block)
block->i_buffer -= 4; /* 32-bits RTP/MPA header */
block->p_buffer += 4;
-
- codec_decode (demux, data, block);
+ block->i_dts = VLC_TICK_INVALID;
+ vlc_rtp_es_send(data, block);
+ (void) pt;
}
static const struct vlc_rtp_pt_operations rtp_audio_mpa = {
- mpa_init, codec_destroy, mpa_decode,
+ NULL, mpa_init, codec_destroy, mpa_decode,
};
/* PT=32
@@ -230,10 +186,10 @@ static void *mpv_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, VIDEO_ES, VLC_CODEC_MPGV);
fmt.b_packetized = false;
(void) pt;
- return codec_init (demux, &fmt);
+ return vlc_rtp_es_request(demux, &fmt);
}
-static void mpv_decode (demux_t *demux, void *data, block_t *block)
+static void mpv_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
if (block->i_buffer < 4)
{
@@ -243,6 +199,7 @@ static void mpv_decode (demux_t *demux, void *data, block_t *block)
block->i_buffer -= 4; /* 32-bits RTP/MPV header */
block->p_buffer += 4;
+ block->i_dts = VLC_TICK_INVALID;
#if 0
if (block->p_buffer[-3] & 0x4)
{
@@ -250,11 +207,12 @@ static void mpv_decode (demux_t *demux, void *data, block_t *block)
/* TODO: shouldn't we skip this too ? */
}
#endif
- codec_decode (demux, data, block);
+ vlc_rtp_es_send(data, block);
+ (void) pt;
}
static const struct vlc_rtp_pt_operations rtp_video_mpv = {
- mpv_init, codec_destroy, mpv_decode,
+ NULL, mpv_init, codec_destroy, mpv_decode,
};
/* PT=33
@@ -263,11 +221,11 @@ static const struct vlc_rtp_pt_operations rtp_video_mpv = {
static void *ts_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
(void) pt;
- return stream_init (demux, "ts");
+ return vlc_rtp_mux_request(demux, "ts");
}
static const struct vlc_rtp_pt_operations rtp_av_ts = {
- ts_init, stream_destroy, stream_decode,
+ NULL, ts_init, codec_destroy, codec_decode,
};
/* Not using SDP, we need to guess the payload format used */
@@ -352,6 +310,8 @@ static struct vlc_rtp_pt *vlc_rtp_pt_create(vlc_object_t *obj,
void vlc_rtp_pt_release(struct vlc_rtp_pt *pt)
{
+ if (pt->ops->release != NULL)
+ pt->ops->release(pt);
free(pt);
}
@@ -504,3 +464,24 @@ int vlc_rtp_add_media_types(vlc_object_t *obj, rtp_session_t *session,
return errors;
}
+
+static void es_dummy_destroy(struct vlc_rtp_es *es)
+{
+ assert(es == vlc_rtp_es_dummy);
+}
+
+static void es_dummy_decode(struct vlc_rtp_es *es, block_t *block)
+{
+ assert(es == vlc_rtp_es_dummy);
+ block_Release(block);
+}
+
+static const struct vlc_rtp_es_operations vlc_rtp_es_dummy_ops = {
+ es_dummy_destroy, es_dummy_decode,
+};
+
+static struct vlc_rtp_es vlc_rtp_es_dummy_instance = {
+ &vlc_rtp_es_dummy_ops,
+};
+
+struct vlc_rtp_es *const vlc_rtp_es_dummy = &vlc_rtp_es_dummy_instance;
=====================================
modules/access/rtp/session.c
=====================================
@@ -166,7 +166,8 @@ rtp_source_destroy (demux_t *demux, const rtp_session_t *session,
msg_Dbg (demux, "removing RTP source (%08x)", source->ssrc);
for (unsigned i = 0; i < session->ptc; i++)
- vlc_rtp_pt_end(session->ptv[i], demux, source->opaque[i]);
+ vlc_rtp_pt_end(session->ptv[i], source->opaque[i]);
+
block_ChainRelease (source->blocks);
free (source);
}
@@ -183,7 +184,7 @@ static inline uint32_t rtp_timestamp (const block_t *block)
return GetDWBE (block->p_buffer + 4);
}
-static const struct vlc_rtp_pt *
+static struct vlc_rtp_pt *
rtp_find_ptype (const rtp_session_t *session, rtp_source_t *source,
const block_t *block, void **pt_data)
{
@@ -306,8 +307,8 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
int16_t s;
} delta_seq = { .u = seq - src->max_seq };
- if ((delta_seq.s > 0) ? (delta_seq.u > p_sys->max_dropout)
- : (delta_seq.u < p_sys->max_misorder))
+ if ((delta_seq.s >= 0) ? (delta_seq.u > p_sys->max_dropout)
+ : (delta_seq.u < p_sys->max_misorder))
{
msg_Dbg (demux, "sequence discontinuity"
" (got: %"PRIu16", expected: %"PRIu16")", seq, src->max_seq);
@@ -469,7 +470,7 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
/* Match the payload type */
void *pt_data;
- const rtp_pt_t *pt = rtp_find_ptype (session, src, block, &pt_data);
+ struct vlc_rtp_pt *pt = rtp_find_ptype (session, src, block, &pt_data);
if (pt == NULL)
{
msg_Dbg (demux, "unknown payload (%"PRIu8")",
@@ -512,7 +513,7 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
block->p_buffer += skip;
block->i_buffer -= skip;
- vlc_rtp_pt_decode(pt, demux, pt_data, block);
+ vlc_rtp_pt_decode(pt, pt_data, block);
return;
drop:
=====================================
modules/access/rtp/xiph.c
=====================================
@@ -37,7 +37,7 @@
typedef struct rtp_xiph_t
{
- es_out_id_t *id;
+ struct vlc_rtp_es *id;
block_t *block;
uint32_t ident;
bool vorbis;
@@ -73,11 +73,11 @@ static void *vorbis_init (demux_t *demux)
*/
static void *theora_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
- (void) pt; (void) demux;
+ pt->opaque = demux;
return xiph_init (false);
}
-static void xiph_destroy(demux_t *demux, void *data)
+static void xiph_destroy(struct vlc_rtp_pt *pt, void *data)
{
rtp_xiph_t *self = data;
@@ -86,10 +86,11 @@ static void xiph_destroy(demux_t *demux, void *data)
if (self->block)
{
self->block->i_flags |= BLOCK_FLAG_CORRUPTED;
- codec_decode (demux, self->id, self->block);
+ vlc_rtp_es_send(self->id, self->block);
}
- codec_destroy (demux, self->id);
+ vlc_rtp_es_destroy(self->id);
free (self);
+ (void) pt;
}
/* Convert configuration from RTP to VLC format */
@@ -142,9 +143,10 @@ static ssize_t xiph_header (void **pextra, const uint8_t *buf, size_t len)
return extra_size;
}
-static void xiph_decode(demux_t *demux, void *data, block_t *block)
+static void xiph_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
rtp_xiph_t *self = data;
+ demux_t *demux = pt->opaque;
if (!data || block->i_buffer < 4)
goto drop;
@@ -246,7 +248,8 @@ static void xiph_decode(demux_t *demux, void *data, block_t *block)
block_t *raw = block_Alloc (len);
memcpy (raw->p_buffer, block->p_buffer, len);
raw->i_pts = block->i_pts; /* FIXME: what about pkts > 1 */
- codec_decode (demux, self->id, raw);
+ block->i_dts = VLC_TICK_INVALID;
+ vlc_rtp_es_send(self->id, raw);
break;
}
@@ -266,13 +269,13 @@ static void xiph_decode(demux_t *demux, void *data, block_t *block)
: VLC_CODEC_THEORA);
fmt.p_extra = extv;
fmt.i_extra = extc;
- codec_destroy (demux, self->id);
+ vlc_rtp_es_destroy(self->id);
msg_Dbg (demux, self->vorbis ?
"Vorbis packed configuration received (%06"PRIx32")" :
"Theora packed configuration received (%06"PRIx32")",
ident);
self->ident = ident;
- self->id = codec_init (demux, &fmt);
+ self->id = vlc_rtp_es_request(demux, &fmt);
break;
}
}
@@ -287,5 +290,5 @@ drop:
}
const struct vlc_rtp_pt_operations rtp_video_theora = {
- theora_init, xiph_destroy, xiph_decode,
+ NULL, theora_init, xiph_destroy, xiph_decode,
};
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c2549ced70d5a6c56fd2411519b185b4a04c36d2...255c27e617bebd5c85c29cd3f3b62a9b79f466a2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c2549ced70d5a6c56fd2411519b185b4a04c36d2...255c27e617bebd5c85c29cd3f3b62a9b79f466a2
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list