mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 04:52:28 +00:00
gst/mpegdemux/gstmpegdemux.c: Use the adjusted SCR for calculating the mux rate.
Original commit message from CVS: * gst/mpegdemux/gstmpegdemux.c: (gst_flups_demux_src_query), (gst_flups_demux_parse_pack_start): Use the adjusted SCR for calculating the mux rate. Don't update the rate estimation after a discont.
This commit is contained in:
parent
32a2faa550
commit
679c4b992c
2 changed files with 25 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-12-29 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/mpegdemux/gstmpegdemux.c: (gst_flups_demux_src_query),
|
||||
(gst_flups_demux_parse_pack_start):
|
||||
Use the adjusted SCR for calculating the mux rate.
|
||||
Don't update the rate estimation after a discont.
|
||||
|
||||
2008-12-29 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/mpegdemux/gstmpegdemux.c: (gst_flups_demux_send_data):
|
||||
|
|
|
@ -960,8 +960,14 @@ gst_flups_demux_src_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
gst_query_parse_duration (query, &format, &duration);
|
||||
|
||||
GST_LOG_OBJECT (demux,
|
||||
"query on peer pad reported bytes %" G_GUINT64_FORMAT, duration);
|
||||
|
||||
duration = BYTES_TO_GSTTIME (duration);
|
||||
|
||||
GST_LOG_OBJECT (demux, "converted to time %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (duration));
|
||||
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
|
||||
res = TRUE;
|
||||
break;
|
||||
|
@ -1013,6 +1019,8 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
|
|||
guint length;
|
||||
guint32 scr1, scr2;
|
||||
guint64 scr, scr_adjusted, new_rate;
|
||||
guint64 scr_rate_n;
|
||||
guint64 scr_rate_d;
|
||||
|
||||
GST_DEBUG ("parsing pack start");
|
||||
|
||||
|
@ -1126,12 +1134,12 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
|
|||
demux->first_scr_offset = demux->last_scr_offset;
|
||||
demux->base_time = MPEGTIME_TO_GSTTIME (demux->first_scr);
|
||||
/* at begin consider the new_rate as the scr rate, bytes/clock ticks */
|
||||
demux->scr_rate_n = new_rate;
|
||||
demux->scr_rate_d = CLOCK_FREQ;
|
||||
scr_rate_n = new_rate;
|
||||
scr_rate_d = CLOCK_FREQ;
|
||||
} else if (demux->first_scr_offset != demux->last_scr_offset) {
|
||||
/* estimate byte rate related to the SCR */
|
||||
demux->scr_rate_n = demux->last_scr_offset - demux->first_scr_offset;
|
||||
demux->scr_rate_d = scr - demux->first_scr;
|
||||
scr_rate_n = demux->last_scr_offset - demux->first_scr_offset;
|
||||
scr_rate_d = scr_adjusted - demux->first_scr;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (demux, "%s mode scr: %" G_GUINT64_FORMAT " at %"
|
||||
|
@ -1141,8 +1149,7 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
|
|||
((demux->sink_segment.rate >= 0.0) ? "forward" : "backward"),
|
||||
scr, demux->last_scr_offset,
|
||||
demux->first_scr, demux->first_scr_offset,
|
||||
demux->scr_rate_n, demux->scr_rate_d,
|
||||
(float) demux->scr_rate_n / demux->scr_rate_d);
|
||||
scr_rate_n, scr_rate_d, (float) scr_rate_n / scr_rate_d);
|
||||
|
||||
/* adjustment of the SCR */
|
||||
if (demux->current_scr != G_MAXUINT64) {
|
||||
|
@ -1188,6 +1195,9 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
|
|||
GST_DEBUG_OBJECT (demux, "discont found, diff: %" G_GINT64_FORMAT
|
||||
", adjust %" G_GINT64_FORMAT, diff, demux->scr_adjust);
|
||||
scr_adjusted = demux->next_scr;
|
||||
/* don't update rate estimation on disconts */
|
||||
scr_rate_n = demux->scr_rate_n;
|
||||
scr_rate_d = demux->scr_rate_d;
|
||||
} else {
|
||||
demux->next_scr = scr_adjusted;
|
||||
}
|
||||
|
@ -1196,6 +1206,8 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
|
|||
/* update the current_scr and rate members */
|
||||
demux->mux_rate = new_rate;
|
||||
demux->current_scr = scr_adjusted;
|
||||
demux->scr_rate_n = scr_rate_n;
|
||||
demux->scr_rate_d = scr_rate_d;
|
||||
|
||||
/* Reset the bytes_since_scr value to count the data remaining in the
|
||||
* adapter */
|
||||
|
|
Loading…
Reference in a new issue