Commit 5ac972d7 authored by Pierre Ynard's avatar 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.
parent 0c1d5a89
......@@ -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;
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment