]> git.sesse.net Git - vlc/commitdiff
live555 : fix pause and seek behaviour.
authorSébastien Escudier <sebastien-devel@celeos.eu>
Tue, 25 Aug 2009 07:03:49 +0000 (09:03 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 25 Aug 2009 13:56:37 +0000 (16:56 +0300)
We must not send PAUSE if already in pause, when seeking (it would
unpause the stream). And DEMUX_SET_PAUSE_STATE should do nothing if
pause state is already what we want.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/demux/live555.cpp

index fffc19d204d6a442b530590874eef4f831027d52..a472cc25944934b7b7342bdfeee1e7a5106e37af 100644 (file)
@@ -1284,10 +1284,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                     time = f * (double)p_sys->i_npt_length;   /* in second */
                 }
 
-                if( !p_sys->rtsp->pauseMediaSession( *p_sys->ms ) ||
-                    !p_sys->rtsp->playMediaSession( *p_sys->ms, time, -1, 1 ) )
+                if( !p_sys->b_paused && !p_sys->rtsp->pauseMediaSession( *p_sys->ms ))
                 {
-                    msg_Err( p_demux, "PLAY failed %s",
+                    msg_Err( p_demux, "PAUSE before seek failed failed %s",
+                        p_sys->env->getResultMsg() );
+                    return VLC_EGENERIC;
+                }
+                if( !p_sys->rtsp->playMediaSession( *p_sys->ms, time, -1, 1 ) )
+                {
+                    msg_Err( p_demux, "seek PLAY failed %s",
                         p_sys->env->getResultMsg() );
                     return VLC_EGENERIC;
                 }
@@ -1402,19 +1407,20 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_SET_PAUSE_STATE:
         {
             int i;
-
-            p_sys->b_paused = (bool)va_arg( args, int );
+            bool b_pause = (bool)va_arg( args, int );
             if( p_sys->rtsp == NULL )
                 return VLC_EGENERIC;
 
-            /* FIXME */
-            if( ( p_sys->b_paused && !p_sys->rtsp->pauseMediaSession( *p_sys->ms ) ) ||
-                    ( !p_sys->b_paused && !p_sys->rtsp->playMediaSession( *p_sys->ms,
+            if( b_pause == p_sys->b_paused )
+                return VLC_SUCCESS;
+            if( ( b_pause && !p_sys->rtsp->pauseMediaSession( *p_sys->ms ) ) ||
+                    ( !b_pause && !p_sys->rtsp->playMediaSession( *p_sys->ms,
                        -1 ) ) )
             {
                     msg_Err( p_demux, "PLAY or PAUSE failed %s", p_sys->env->getResultMsg() );
                     return VLC_EGENERIC;
             }
+            p_sys->b_paused = b_pause;
 
             /* When we Pause, we'll need the TimeoutPrevention thread to
              * handle sending the "Keep Alive" message to the server.