diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2011-08-31 03:47:52 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-08-31 12:12:33 +0200 |
commit | 0c97deb59dae4bf49c7dab15d89dc4af5b4b76b1 (patch) | |
tree | 7b3ba385a39f36141896a5c927014ebdc424bc5b /gst/hls | |
parent | 6436747eb0a453b9fedffe04af14c9c8957e61a8 (diff) | |
download | gstreamer-plugins-bad-0c97deb59dae4bf49c7dab15d89dc4af5b4b76b1.tar.gz |
hlsdemux: switch to higher/lower bitrate by more than one step at a time
Diffstat (limited to 'gst/hls')
-rw-r--r-- | gst/hls/gsthlsdemux.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index a7f3a4b56..bfda3a5c8 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -1229,14 +1229,20 @@ gst_hls_demux_switch_playlist (GstHLSDemux * demux) /* if we are on time switch to a higher bitrate */ if (diff > limit) { - gst_hls_demux_change_playlist (demux, TRUE); + while (diff > limit) { + gst_hls_demux_change_playlist (demux, TRUE); + diff -= limit; + } + demux->accumulated_delay = 0; } else if (diff < 0) { /* if the client is too slow wait until it has accumulated a certain delay to * switch to a lower bitrate */ demux->accumulated_delay -= diff; if (demux->accumulated_delay >= limit) { - gst_hls_demux_change_playlist (demux, FALSE); - } else if (demux->accumulated_delay < 0) { + while (demux->accumulated_delay >= limit) { + gst_hls_demux_change_playlist (demux, FALSE); + demux->accumulated_delay -= limit; + } demux->accumulated_delay = 0; } } |