Commit 1cab81b1 authored by Pierre Ynard's avatar Pierre Ynard

VoD: fix deadlock between RTSP and VLM

The deadlock would occur when the VLM would stop an instance and detach
its RTP output, at the same time as an RTSP client would issue a VoD
command to the VLM.

Unfortunately this introduces a race condition where wrong RTP-Info can
be returned.
(cherry picked from commit 7ac6ae55)
Signed-off-by: default avatarPierre Ynard <linkfanel@yahoo.fr>
parent ff2b15c7
...@@ -1052,16 +1052,17 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id, ...@@ -1052,16 +1052,17 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
info[infolen - 2] = '\0'; /* remove trailing ", " */ info[infolen - 2] = '\0'; /* remove trailing ", " */
httpd_MsgAdd( answer, "RTP-Info", "%s", info ); httpd_MsgAdd( answer, "RTP-Info", "%s", info );
} }
}
vlc_mutex_unlock( &rtsp->lock );
if (ses != NULL)
{
if (vod) if (vod)
{ {
vod_play(rtsp->vod_media, psz_session, &start, end); vod_play(rtsp->vod_media, psz_session, &start, end);
npt = start; npt = start;
} }
}
vlc_mutex_unlock( &rtsp->lock );
if (ses != NULL)
{
double f_npt = (double) npt / CLOCK_FREQ; double f_npt = (double) npt / CLOCK_FREQ;
httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt ); httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
} }
...@@ -1089,15 +1090,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id, ...@@ -1089,15 +1090,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
ses = RtspClientGet( rtsp, psz_session ); ses = RtspClientGet( rtsp, psz_session );
if (ses != NULL) if (ses != NULL)
{ {
if (id == NULL) if (id != NULL) /* "Mute" the selected track */
{
assert(vod);
int64_t npt;
vod_pause(rtsp->vod_media, psz_session, &npt);
double f_npt = (double) npt / CLOCK_FREQ;
httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
}
else /* "Mute" the selected track */
{ {
bool found = false; bool found = false;
for (int i = 0; i < ses->trackc; i++) for (int i = 0; i < ses->trackc; i++)
...@@ -1123,6 +1116,15 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id, ...@@ -1123,6 +1116,15 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
RtspClientAlive(ses); RtspClientAlive(ses);
} }
vlc_mutex_unlock( &rtsp->lock ); vlc_mutex_unlock( &rtsp->lock );
if (ses != NULL && id == NULL)
{
assert(vod);
int64_t npt = 0;
vod_pause(rtsp->vod_media, psz_session, &npt);
double f_npt = (double) npt / CLOCK_FREQ;
httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
}
break; break;
} }
......
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