[MOVED FROM GST-P-FARSIGHT] Use segment to calculate dtmfsrc rtp timestamp

20070412200435-3e2dc-b5cc26b12b6e8b89f131fd27f0e4627746e85697.gz
This commit is contained in:
Olivier Crete 2007-04-12 20:04:35 +00:00 committed by Edward Hervey
parent 50dbdcc4e1
commit 516f1cb727
2 changed files with 22 additions and 2 deletions

View file

@ -391,6 +391,22 @@ gst_rtp_dtmf_src_handle_event (GstPad * pad, GstEvent * event)
gst_rtp_dtmf_src_stop (dtmfsrc);
result = TRUE;
break;
case GST_EVENT_FLUSH_STOP:
gst_segment_init (&dtmfsrc->segment, GST_FORMAT_UNDEFINED);
break;
case GST_EVENT_NEWSEGMENT:
{
gboolean update;
gdouble rate;
GstFormat fmt;
gint64 start, stop, position;
gst_event_parse_new_segment (event, &update, &rate, &fmt, &start, &stop,
&position);
gst_segment_set_newsegment (&dtmfsrc->segment, update, rate, fmt,
start, stop, position);
}
/* fallthrough */
default:
result = gst_pad_event_default (pad, event);
break;
@ -497,8 +513,9 @@ gst_rtp_dtmf_prepare_timestamps (GstRTPDTMFSrc *dtmfsrc)
dtmfsrc->rtp_timestamp = dtmfsrc->ts_base +
gst_util_uint64_scale_int (
dtmfsrc->timestamp - gst_element_get_base_time (GST_ELEMENT (dtmfsrc)),
dtmfsrc->clock_rate, GST_SECOND);
gst_segment_to_running_time (&dtmfsrc->segment, GST_FORMAT_TIME,
dtmfsrc->timestamp - gst_element_get_base_time (GST_ELEMENT (dtmfsrc))),
dtmfsrc->clock_rate, GST_SECOND);
}
static void
@ -676,6 +693,8 @@ gst_rtp_dtmf_src_set_caps (GstRTPDTMFSrc *dtmfsrc)
static void
gst_rtp_dtmf_src_ready_to_paused (GstRTPDTMFSrc *dtmfsrc)
{
gst_segment_init (&dtmfsrc->segment, GST_FORMAT_UNDEFINED);
if (dtmfsrc->ssrc == -1)
dtmfsrc->current_ssrc = g_random_int ();
else

View file

@ -83,6 +83,7 @@ struct _GstRTPDTMFSrc {
gboolean first_packet;
GstClockTime timestamp;
GstSegment segment;
};
struct _GstRTPDTMFSrcClass {