[vlc-devel] commit: Auto reset rate to source rate when no more buffered data. ( Laurent Aimar )

git version control git at videolan.org
Mon Nov 17 20:16:39 CET 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Nov 15 21:04:26 2008 +0100| [b51fa63017557ea4f8971a8cfe6f87ae2a852556] | committer: Laurent Aimar 

Auto reset rate to source rate when no more buffered data.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b51fa63017557ea4f8971a8cfe6f87ae2a852556
---

 src/input/es_out_timeshift.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 896eec9..d866284 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -638,14 +638,27 @@ static void *TsRun( vlc_object_t *p_thread )
             const mtime_t i_duration = cmd.i_date - p_sys->i_rate_date;
             p_sys->i_rate_delay = i_duration * p_sys->i_rate / p_sys->i_rate_source - i_duration;
         }
-
-        i_deadline = cmd.i_date + p_sys->i_cmd_delay + p_sys->i_rate_delay;
-
         if( p_sys->i_cmd_delay + p_sys->i_rate_delay < 0 )
         {
-            /* TODO handle when we cannot go faster anymore */
-            msg_Err( p_sys->p_input, "FIXME rate underflow" );
+            /* Auto reset to rate 1.0 */
+            msg_Warn( p_sys->p_input, "es out timeshift: auto reset rate to %d", p_sys->i_rate_source );
+
+            p_sys->i_cmd_delay = 0;
+
+            p_sys->i_rate_date = -1;
+            p_sys->i_rate_delay = 0;
+            p_sys->i_rate = p_sys->i_rate_source;
+
+            if( !es_out_SetRate( p_sys->p_out, p_sys->i_rate_source, p_sys->i_rate ) )
+            {
+                vlc_value_t val = { .i_int = p_sys->i_rate };
+                /* Warn back input
+                 * FIXME it is perfectly safe BUT it is ugly as it may hide a
+                 * rate change requested by user */
+                input_ControlPush( p_sys->p_input, INPUT_CONTROL_SET_RATE, &val );
+            }
         }
+        i_deadline = cmd.i_date + p_sys->i_cmd_delay + p_sys->i_rate_delay;
 
         vlc_cleanup_run();
 




More information about the vlc-devel mailing list