* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more
+ * Library General Public License for more
*/
/**
LAST_SIGNAL
};
-/* FIXME 0.11, a better default is the Ethernet MTU of
+/* FIXME 0.11, a better default is the Ethernet MTU of
* 1500 - sizeof(headers) as pointed out by marcelm in IRC:
* So an Ethernet MTU of 1500, minus 60 for the max IP, minus 8 for UDP, gives
* 1432 bytes or so. And that should be adjusted downward further for other
* @payload: a #GstBaseRTPPayload
* @media: the media type (typically "audio" or "video")
* @dynamic: if the payload type is dynamic
- * @encoding_name: the encoding name
+ * @encoding_name: the encoding name
* @clock_rate: the clock rate of the media
*
* Set the rtp options of the payloader. These options will be set in the caps
guint8 pt;
GstCaps *caps;
GstClockTime timestamp;
+ guint64 offset;
guint32 rtptime;
} HeaderData;
find_timestamp (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
{
data->timestamp = GST_BUFFER_TIMESTAMP (*buffer);
+ data->offset = GST_BUFFER_OFFSET (*buffer);
- /* stop when we find a timestamp */
- if (data->timestamp != -1)
+ /* stop when we find a timestamp and duration */
+ if (data->timestamp != -1 && data->offset != -1)
return GST_BUFFER_LIST_END;
else
return GST_BUFFER_LIST_CONTINUE;
gst_rtp_buffer_set_seq (*buffer, data->seqnum);
gst_rtp_buffer_set_timestamp (*buffer, data->rtptime);
gst_buffer_set_caps (*buffer, data->caps);
+ /* increment the seqnum for each buffer */
data->seqnum++;
return GST_BUFFER_LIST_SKIP_GROUP;
(GstBufferListFunc) find_timestamp, &data);
} else {
data.timestamp = GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (obj));
+ data.offset = GST_BUFFER_OFFSET (GST_BUFFER_CAST (obj));
}
/* convert to RTP time */
- if (GST_CLOCK_TIME_IS_VALID (data.timestamp)) {
+ if (data.offset != GST_BUFFER_OFFSET_NONE) {
+ /* if we have an offset, use that for making an RTP timestamp */
+ data.rtptime = payload->ts_base + data.offset;
+ } else if (GST_CLOCK_TIME_IS_VALID (data.timestamp)) {
gint64 rtime;
+ /* no offset, use the gstreamer timestamp */
rtime = gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
data.timestamp);
*
* Push @buffer to the peer element of the payloader. The SSRC, payload type,
* seqnum and timestamp of the RTP buffer will be updated first.
- *
+ *
* This function takes ownership of @buffer.
*
* Returns: a #GstFlowReturn.