[vlc-commits] commit: vod: don't handle pause state toggling in the RTSP stack ( Pierre Ynard )

git at videolan.org git at videolan.org
Fri Nov 19 13:49:29 CET 2010


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Nov 19 13:45:54 2010 +0100| [5ac972d7f71ec8b80ed88806c7bf2246e8c2af1f] | committer: Pierre Ynard 

vod: don't handle pause state toggling in the RTSP stack

RTSP doesn't toggle pause state, it sends unconditional PLAY/PAUSE
commands. Let the VLM handle it.

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

 modules/misc/rtsp.c       |   36 +++++++-----------------------------
 modules/stream_out/rtp.h  |    2 +-
 modules/stream_out/rtsp.c |   16 ++++------------
 modules/stream_out/vod.c  |    4 +---
 src/input/vlm.c           |    2 +-
 5 files changed, 14 insertions(+), 46 deletions(-)

diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c
index 910533f..77123af 100644
--- a/modules/misc/rtsp.c
+++ b/modules/misc/rtsp.c
@@ -113,7 +113,6 @@ typedef struct
     char *psz_session;
 
     bool b_playing; /* is it in "play" state */
-    bool b_paused; /* is it in "pause" state */
 
     int i_es;
     rtsp_client_es_t **es;
@@ -1138,26 +1137,13 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                             CommandPush( p_vod, RTSP_CMD_TYPE_FORWARD, p_media,
                                          psz_session, 0, f_scale, NULL );
                         }
-
-                        if( p_rtsp->b_paused )
-                        {
-                            p_rtsp->b_paused = false;
-                            CommandPush( p_vod, RTSP_CMD_TYPE_PAUSE, p_media,
-                                         psz_session, 0, 0.0, NULL );
-                        }
                     }
-                    break;
                 }
-            }
-
-            if( p_rtsp->b_playing && p_rtsp->b_paused )
-            {
-                CommandPush( p_vod, RTSP_CMD_TYPE_PAUSE, p_media,
-                             psz_session, 0, 0.0, NULL );
-                p_rtsp->b_paused = false;
+                /* unpause, in case it's paused */
+                CommandPush( p_vod, RTSP_CMD_TYPE_PLAY, p_media, psz_session,
+                             0, 0.0, "" );
                 break;
             }
-            else if( p_rtsp->b_playing ) break;
 
             if( httpd_ClientIP( cl, ip ) == NULL ) break;
 
@@ -1233,12 +1219,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             p_rtsp = RtspClientGet( p_media, psz_session );
             if( !p_rtsp ) break;
 
-            if( !p_rtsp->b_paused )
-            {
-                CommandPush( p_vod, RTSP_CMD_TYPE_PAUSE, p_media, psz_session,
-                             0, 0.0, NULL );
-                p_rtsp->b_paused = true;
-            }
+            CommandPush( p_vod, RTSP_CMD_TYPE_PAUSE, p_media, psz_session,
+                         0, 0.0, NULL );
 
             answer->i_status = 200;
             answer->i_body = 0;
@@ -1494,12 +1476,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             p_rtsp = RtspClientGet( p_media, psz_session );
             if( !p_rtsp ) break;
 
-            if( !p_rtsp->b_paused )
-            {
-                CommandPush( p_vod, RTSP_CMD_TYPE_PAUSE, p_media, psz_session,
-                             0, 0.0, NULL );
-                p_rtsp->b_paused = true;
-            }
+            CommandPush( p_vod, RTSP_CMD_TYPE_PAUSE, p_media, psz_session,
+                         0, 0.0, NULL );
 
             answer->i_status = 200;
             answer->i_body = 0;
diff --git a/modules/stream_out/rtp.h b/modules/stream_out/rtp.h
index 1abfa31..a391577 100644
--- a/modules/stream_out/rtp.h
+++ b/modules/stream_out/rtp.h
@@ -91,7 +91,7 @@ int  OpenVoD ( vlc_object_t * );
 void CloseVoD( vlc_object_t * );
 
 void vod_start(vod_media_t *p_media, const char *psz_session);
-void vod_toggle_pause(vod_media_t *p_media, const char *psz_session);
+void vod_pause(vod_media_t *p_media, const char *psz_session);
 void vod_stop(vod_media_t *p_media, const char *psz_session);
 void vod_seek(vod_media_t *p_media, const char *psz_session, int64_t time);
 
diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 17f8dc3..2e00424 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -173,7 +173,6 @@ struct rtsp_session_t
     rtsp_stream_t *stream;
     uint64_t       id;
     bool           vod_started; /* true if the VoD media instance was created */
-    bool           paused;      /* true if the client paused the VoD instance */
 
     /* output (id-access) */
     int            trackc;
@@ -300,7 +299,6 @@ rtsp_session_t *RtspClientNew( rtsp_stream_t *rtsp )
     s->stream = rtsp;
     vlc_rand_bytes (&s->id, sizeof (s->id));
     s->vod_started = false;
-    s->paused = false;
     s->trackc = 0;
     s->trackv = NULL;
 
@@ -900,11 +898,8 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                             int64_t time = ParseNPT (range + 4);
                             vod_seek(rtsp->vod_media, psz_session, time);
                         }
-                        if (ses->paused)
-                        {
-                            vod_toggle_pause(rtsp->vod_media, psz_session);
-                            ses->paused = false;
-                        }
+                        /* This is the thing to do to unpause... */
+                        vod_start(rtsp->vod_media, psz_session);
                     }
                 }
             }
@@ -931,11 +926,8 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
             psz_session = httpd_MsgGet( query, "Session" );
             vlc_mutex_lock( &rtsp->lock );
             ses = RtspClientGet( rtsp, psz_session );
-            if (ses != NULL && !ses->paused)
-            {
-                vod_toggle_pause(rtsp->vod_media, psz_session);
-                ses->paused = true;
-            }
+            if (ses != NULL)
+                vod_pause(rtsp->vod_media, psz_session);
             vlc_mutex_unlock( &rtsp->lock );
             break;
         }
diff --git a/modules/stream_out/vod.c b/modules/stream_out/vod.c
index 11cb7f7..a5c64cb 100644
--- a/modules/stream_out/vod.c
+++ b/modules/stream_out/vod.c
@@ -548,9 +548,7 @@ void vod_start(vod_media_t *p_media, const char *psz_session)
                 psz_session, 0, "vod");
 }
 
-/* FIXME: this sucks, RTSP doesn't really toggle the pause state, it
- * either PAUSEs or PLAYs */
-void vod_toggle_pause(vod_media_t *p_media, const char *psz_session)
+void vod_pause(vod_media_t *p_media, const char *psz_session)
 {
     CommandPush(p_media->p_vod, RTSP_CMD_TYPE_PAUSE, p_media,
                 psz_session, 0, NULL);
diff --git a/src/input/vlm.c b/src/input/vlm.c
index b5517a8..080fd8f 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -1040,7 +1040,7 @@ static int vlm_ControlMediaInstancePause( vlm_t *p_vlm, int64_t id, const char *
 
     /* Toggle pause state */
     i_state = var_GetInteger( p_instance->p_input, "state" );
-    if( i_state == PAUSE_S )
+    if( i_state == PAUSE_S && !p_media->cfg.b_vod )
         var_SetInteger( p_instance->p_input, "state", PLAYING_S );
     else if( i_state == PLAYING_S )
         var_SetInteger( p_instance->p_input, "state", PAUSE_S );



More information about the vlc-commits mailing list