summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--gst/rtp/TODO14
-rw-r--r--gst/rtp/gstrtpdec.c8
-rw-r--r--gst/rtp/gstrtpdepay.c8
-rw-r--r--gst/rtp/gstrtpmp4venc.c14
-rw-r--r--gst/rtp/gstrtpmp4venc.h1
-rw-r--r--gst/rtp/gstrtpmp4vpay.c14
-rw-r--r--gst/rtp/gstrtpmp4vpay.h1
-rw-r--r--gst/rtp/gstrtpmpaenc.c18
-rw-r--r--gst/rtp/gstrtpmpaenc.h1
-rw-r--r--gst/rtp/gstrtpmpapay.c18
-rw-r--r--gst/rtp/gstrtpmpapay.h1
12 files changed, 73 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index f43cc337..25a11661 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
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),
(gst_rtpmp4venc_parse_data), (gst_rtpmp4venc_handle_buffer),
(gst_rtpmp4venc_set_property):
diff --git a/gst/rtp/TODO b/gst/rtp/TODO
index 658e381f..8065a9ce 100644
--- a/gst/rtp/TODO
+++ b/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
diff --git a/gst/rtp/gstrtpdec.c b/gst/rtp/gstrtpdec.c
index 96089c47..95065a2f 100644
--- a/gst/rtp/gstrtpdec.c
+++ b/gst/rtp/gstrtpdec.c
@@ -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
diff --git a/gst/rtp/gstrtpdepay.c b/gst/rtp/gstrtpdepay.c
index 96089c47..95065a2f 100644
--- a/gst/rtp/gstrtpdepay.c
+++ b/gst/rtp/gstrtpdepay.c
@@ -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
diff --git a/gst/rtp/gstrtpmp4venc.c b/gst/rtp/gstrtpmp4venc.c
index 08d9b2d3..08644edb 100644
--- a/gst/rtp/gstrtpmp4venc.c
+++ b/gst/rtp/gstrtpmp4venc.c
@@ -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;
}
diff --git a/gst/rtp/gstrtpmp4venc.h b/gst/rtp/gstrtpmp4venc.h
index 996b9a7b..73544274 100644
--- a/gst/rtp/gstrtpmp4venc.h
+++ b/gst/rtp/gstrtpmp4venc.h
@@ -46,6 +46,7 @@ struct _GstRtpMP4VEnc
GstAdapter *adapter;
GstClockTime first_ts;
+ GstClockTime duration;
gint rate;
gint profile;
diff --git a/gst/rtp/gstrtpmp4vpay.c b/gst/rtp/gstrtpmp4vpay.c
index 08d9b2d3..08644edb 100644
--- a/gst/rtp/gstrtpmp4vpay.c
+++ b/gst/rtp/gstrtpmp4vpay.c
@@ -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;
}
diff --git a/gst/rtp/gstrtpmp4vpay.h b/gst/rtp/gstrtpmp4vpay.h
index 996b9a7b..73544274 100644
--- a/gst/rtp/gstrtpmp4vpay.h
+++ b/gst/rtp/gstrtpmp4vpay.h
@@ -46,6 +46,7 @@ struct _GstRtpMP4VEnc
GstAdapter *adapter;
GstClockTime first_ts;
+ GstClockTime duration;
gint rate;
gint profile;
diff --git a/gst/rtp/gstrtpmpaenc.c b/gst/rtp/gstrtpmpaenc.c
index 34aa254e..34d3202e 100644
--- a/gst/rtp/gstrtpmpaenc.c
+++ b/gst/rtp/gstrtpmpaenc.c
@@ -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;
}
diff --git a/gst/rtp/gstrtpmpaenc.h b/gst/rtp/gstrtpmpaenc.h
index 6079f83e..c4eac61f 100644
--- a/gst/rtp/gstrtpmpaenc.h
+++ b/gst/rtp/gstrtpmpaenc.h
@@ -46,6 +46,7 @@ struct _GstRtpMPAEnc
GstAdapter *adapter;
GstClockTime first_ts;
+ GstClockTime duration;
};
struct _GstRtpMPAEncClass
diff --git a/gst/rtp/gstrtpmpapay.c b/gst/rtp/gstrtpmpapay.c
index 34aa254e..34d3202e 100644
--- a/gst/rtp/gstrtpmpapay.c
+++ b/gst/rtp/gstrtpmpapay.c
@@ -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;
}
diff --git a/gst/rtp/gstrtpmpapay.h b/gst/rtp/gstrtpmpapay.h
index 6079f83e..c4eac61f 100644
--- a/gst/rtp/gstrtpmpapay.h
+++ b/gst/rtp/gstrtpmpapay.h
@@ -46,6 +46,7 @@ struct _GstRtpMPAEnc
GstAdapter *adapter;
GstClockTime first_ts;
+ GstClockTime duration;
};
struct _GstRtpMPAEncClass