mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gst/rtp/: Use is_filled to both check MTU and max-ptime of base class.
Original commit message from CVS: * gst/rtp/TODO: * gst/rtp/gstrtpdec.c: (gst_rtpdec_getcaps): * gst/rtp/gstrtpmp4venc.c: (gst_rtpmp4venc_class_init), (gst_rtpmp4venc_parse_data), (gst_rtpmp4venc_handle_buffer), (gst_rtpmp4venc_set_property): * gst/rtp/gstrtpmp4venc.h: * gst/rtp/gstrtpmpaenc.c: (gst_rtpmpaenc_handle_buffer): * gst/rtp/gstrtpmpaenc.h: Use is_filled to both check MTU and max-ptime of base class.
This commit is contained in:
parent
4aac63130a
commit
7067b806e0
12 changed files with 73 additions and 37 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2005-09-22 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/rtp/TODO:
|
||||
* gst/rtp/gstrtpdec.c: (gst_rtpdec_getcaps):
|
||||
* gst/rtp/gstrtpmp4venc.c: (gst_rtpmp4venc_class_init),
|
||||
(gst_rtpmp4venc_parse_data), (gst_rtpmp4venc_handle_buffer),
|
||||
(gst_rtpmp4venc_set_property):
|
||||
* gst/rtp/gstrtpmp4venc.h:
|
||||
* gst/rtp/gstrtpmpaenc.c: (gst_rtpmpaenc_handle_buffer):
|
||||
* gst/rtp/gstrtpmpaenc.h:
|
||||
Use is_filled to both check MTU and max-ptime of base class.
|
||||
|
||||
2005-09-22 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/rtp/gstrtpmp4venc.c: (gst_rtpmp4venc_class_init),
|
||||
|
|
14
gst/rtp/TODO
14
gst/rtp/TODO
|
@ -1,26 +1,14 @@
|
|||
*GstRtpRecv:
|
||||
*gstrtprecv.c
|
||||
|
||||
*For Sequencing:
|
||||
* timestamp
|
||||
* algorithm
|
||||
|
||||
*For Video:
|
||||
* payload_t
|
||||
|
||||
* sequence number should not start at 0, but randomly
|
||||
|
||||
* MPEG4 header
|
||||
- ffmpeg mpeg4 decoder gives error message when sending only the config
|
||||
string, parsing is OK, error just means no picture was found in the
|
||||
stream.
|
||||
|
||||
|
||||
* compare H263 encoders and H263+
|
||||
|
||||
* better RTP packetizing for h263
|
||||
|
||||
* bitrate tuning in ffmpeg
|
||||
- fixed the qmax values so we can quantize more.
|
||||
|
||||
* make ffmpeg negotiate only with accepted framerates
|
||||
|
||||
|
|
|
@ -183,12 +183,18 @@ gst_rtpdec_getcaps (GstPad * pad)
|
|||
{
|
||||
GstRTPDec *src;
|
||||
GstPad *other;
|
||||
GstCaps *caps;
|
||||
|
||||
src = GST_RTPDEC (GST_PAD_PARENT (pad));
|
||||
|
||||
other = pad == src->src_rtp ? src->sink_rtp : src->src_rtp;
|
||||
|
||||
return gst_pad_peer_get_caps (other);
|
||||
caps = gst_pad_peer_get_caps (other);
|
||||
|
||||
if (caps == NULL)
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -183,12 +183,18 @@ gst_rtpdec_getcaps (GstPad * pad)
|
|||
{
|
||||
GstRTPDec *src;
|
||||
GstPad *other;
|
||||
GstCaps *caps;
|
||||
|
||||
src = GST_RTPDEC (GST_PAD_PARENT (pad));
|
||||
|
||||
other = pad == src->src_rtp ? src->sink_rtp : src->src_rtp;
|
||||
|
||||
return gst_pad_peer_get_caps (other);
|
||||
caps = gst_pad_peer_get_caps (other);
|
||||
|
||||
if (caps == NULL)
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -346,6 +346,7 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
guint8 *data;
|
||||
gboolean flush;
|
||||
gint strip;
|
||||
GstClockTime duration;
|
||||
|
||||
ret = GST_FLOW_OK;
|
||||
|
||||
|
@ -353,11 +354,13 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
avail = gst_adapter_available (rtpmp4venc->adapter);
|
||||
|
||||
/* empty buffer, take timestamp */
|
||||
if (avail == 0) {
|
||||
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmp4venc->duration = 0;
|
||||
}
|
||||
|
||||
/* parse incomming data and see if we need to start a new RTP
|
||||
|
@ -382,23 +385,24 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
/* if we need to flush, do so now */
|
||||
if (flush) {
|
||||
ret = gst_rtpmp4venc_flush (rtpmp4venc);
|
||||
avail = 0;
|
||||
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmp4venc->duration = 0;
|
||||
avail = 0;
|
||||
}
|
||||
|
||||
avail = gst_adapter_available (rtpmp4venc->adapter);
|
||||
|
||||
/* get packet length of data and see if we exceeded MTU. */
|
||||
packet_len = gst_rtpbuffer_calc_packet_len (avail + size, 0, 0);
|
||||
|
||||
if (packet_len > GST_BASE_RTP_PAYLOAD_MTU (rtpmp4venc)) {
|
||||
if (gst_basertppayload_is_filled (basepayload,
|
||||
packet_len, rtpmp4venc->duration + duration)) {
|
||||
ret = gst_rtpmp4venc_flush (rtpmp4venc);
|
||||
avail = 0;
|
||||
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmp4venc->duration = 0;
|
||||
}
|
||||
|
||||
/* push new data */
|
||||
gst_adapter_push (rtpmp4venc->adapter, buffer);
|
||||
rtpmp4venc->duration += duration;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ struct _GstRtpMP4VEnc
|
|||
|
||||
GstAdapter *adapter;
|
||||
GstClockTime first_ts;
|
||||
GstClockTime duration;
|
||||
|
||||
gint rate;
|
||||
gint profile;
|
||||
|
|
|
@ -346,6 +346,7 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
guint8 *data;
|
||||
gboolean flush;
|
||||
gint strip;
|
||||
GstClockTime duration;
|
||||
|
||||
ret = GST_FLOW_OK;
|
||||
|
||||
|
@ -353,11 +354,13 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
avail = gst_adapter_available (rtpmp4venc->adapter);
|
||||
|
||||
/* empty buffer, take timestamp */
|
||||
if (avail == 0) {
|
||||
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmp4venc->duration = 0;
|
||||
}
|
||||
|
||||
/* parse incomming data and see if we need to start a new RTP
|
||||
|
@ -382,23 +385,24 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
/* if we need to flush, do so now */
|
||||
if (flush) {
|
||||
ret = gst_rtpmp4venc_flush (rtpmp4venc);
|
||||
avail = 0;
|
||||
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmp4venc->duration = 0;
|
||||
avail = 0;
|
||||
}
|
||||
|
||||
avail = gst_adapter_available (rtpmp4venc->adapter);
|
||||
|
||||
/* get packet length of data and see if we exceeded MTU. */
|
||||
packet_len = gst_rtpbuffer_calc_packet_len (avail + size, 0, 0);
|
||||
|
||||
if (packet_len > GST_BASE_RTP_PAYLOAD_MTU (rtpmp4venc)) {
|
||||
if (gst_basertppayload_is_filled (basepayload,
|
||||
packet_len, rtpmp4venc->duration + duration)) {
|
||||
ret = gst_rtpmp4venc_flush (rtpmp4venc);
|
||||
avail = 0;
|
||||
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmp4venc->duration = 0;
|
||||
}
|
||||
|
||||
/* push new data */
|
||||
gst_adapter_push (rtpmp4venc->adapter, buffer);
|
||||
rtpmp4venc->duration += duration;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ struct _GstRtpMP4VEnc
|
|||
|
||||
GstAdapter *adapter;
|
||||
GstClockTime first_ts;
|
||||
GstClockTime duration;
|
||||
|
||||
gint rate;
|
||||
gint profile;
|
||||
|
|
|
@ -225,11 +225,18 @@ gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
GstFlowReturn ret;
|
||||
guint size, avail;
|
||||
guint packet_len;
|
||||
GstClockTime duration;
|
||||
|
||||
rtpmpaenc = GST_RTP_MPA_ENC (basepayload);
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
avail = gst_adapter_available (rtpmpaenc->adapter);
|
||||
if (avail == 0) {
|
||||
rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmpaenc->duration = 0;
|
||||
}
|
||||
|
||||
/* get packet length of previous data and this new data,
|
||||
* payload length includes a 4 byte header */
|
||||
|
@ -237,18 +244,17 @@ gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
|
||||
/* if this buffer is going to overflow the packet, flush what we
|
||||
* have. */
|
||||
if (packet_len > GST_BASE_RTP_PAYLOAD_MTU (rtpmpaenc)) {
|
||||
if (gst_basertppayload_is_filled (basepayload,
|
||||
packet_len, rtpmpaenc->duration + duration)) {
|
||||
ret = gst_rtpmpaenc_flush (rtpmpaenc);
|
||||
avail = 0;
|
||||
rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmpaenc->duration = 0;
|
||||
} else {
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
gst_adapter_push (rtpmpaenc->adapter, buffer);
|
||||
|
||||
if (avail == 0) {
|
||||
rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
}
|
||||
rtpmpaenc->duration += duration;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ struct _GstRtpMPAEnc
|
|||
|
||||
GstAdapter *adapter;
|
||||
GstClockTime first_ts;
|
||||
GstClockTime duration;
|
||||
};
|
||||
|
||||
struct _GstRtpMPAEncClass
|
||||
|
|
|
@ -225,11 +225,18 @@ gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
GstFlowReturn ret;
|
||||
guint size, avail;
|
||||
guint packet_len;
|
||||
GstClockTime duration;
|
||||
|
||||
rtpmpaenc = GST_RTP_MPA_ENC (basepayload);
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
avail = gst_adapter_available (rtpmpaenc->adapter);
|
||||
if (avail == 0) {
|
||||
rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmpaenc->duration = 0;
|
||||
}
|
||||
|
||||
/* get packet length of previous data and this new data,
|
||||
* payload length includes a 4 byte header */
|
||||
|
@ -237,18 +244,17 @@ gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
|
||||
/* if this buffer is going to overflow the packet, flush what we
|
||||
* have. */
|
||||
if (packet_len > GST_BASE_RTP_PAYLOAD_MTU (rtpmpaenc)) {
|
||||
if (gst_basertppayload_is_filled (basepayload,
|
||||
packet_len, rtpmpaenc->duration + duration)) {
|
||||
ret = gst_rtpmpaenc_flush (rtpmpaenc);
|
||||
avail = 0;
|
||||
rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtpmpaenc->duration = 0;
|
||||
} else {
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
gst_adapter_push (rtpmpaenc->adapter, buffer);
|
||||
|
||||
if (avail == 0) {
|
||||
rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
}
|
||||
rtpmpaenc->duration += duration;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ struct _GstRtpMPAEnc
|
|||
|
||||
GstAdapter *adapter;
|
||||
GstClockTime first_ts;
|
||||
GstClockTime duration;
|
||||
};
|
||||
|
||||
struct _GstRtpMPAEncClass
|
||||
|
|
Loading…
Reference in a new issue