[vlc-commits] VoD: fix deadlock between RTSP and VLM
Pierre Ynard
git at videolan.org
Sun Jan 15 00:48:14 CET 2012
vlc/vlc-1.2 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Jan 15 00:27:52 2012 +0100| [1cab81b1e43fa597d72e8f97b9c5cca22295f88a] | committer: 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 7ac6ae55e2496c7178ce0b15a3c16a2db464a38c)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=1cab81b1e43fa597d72e8f97b9c5cca22295f88a
---
modules/stream_out/rtsp.c | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index c71139f..2f9569a 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -1052,16 +1052,17 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
info[infolen - 2] = '\0'; /* remove trailing ", " */
httpd_MsgAdd( answer, "RTP-Info", "%s", info );
}
+ }
+ vlc_mutex_unlock( &rtsp->lock );
+
+ if (ses != NULL)
+ {
if (vod)
{
vod_play(rtsp->vod_media, psz_session, &start, end);
npt = start;
}
- }
- vlc_mutex_unlock( &rtsp->lock );
- if (ses != NULL)
- {
double f_npt = (double) npt / CLOCK_FREQ;
httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
}
@@ -1089,15 +1090,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
ses = RtspClientGet( rtsp, psz_session );
if (ses != NULL)
{
- if (id == NULL)
- {
- 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 */
+ if (id != NULL) /* "Mute" the selected track */
{
bool found = false;
for (int i = 0; i < ses->trackc; i++)
@@ -1123,6 +1116,15 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
RtspClientAlive(ses);
}
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;
}
More information about the vlc-commits
mailing list