[vlc-devel] commit: live555 : fix pause and seek behaviour. ( Sébastien Escudier )

git version control git at videolan.org
Tue Aug 25 15:57:12 CEST 2009


vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Tue Aug 25 09:03:49 2009 +0200| [fe664dcd844fefa1baa1bfd3d7ccaeb6a2e1f4a3] | committer: Rémi Denis-Courmont 

live555 : fix pause and seek behaviour.

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 at remlab.net>

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

 modules/demux/live555.cpp |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index fffc19d..a472cc2 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -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.




More information about the vlc-devel mailing list