Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6ef65eaf
Commit
6ef65eaf
authored
Dec 23, 2010
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtsp: check Range validity before starting to process the request
parent
c200ffa3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
20 deletions
+38
-20
modules/stream_out/rtp.h
modules/stream_out/rtp.h
+4
-2
modules/stream_out/rtsp.c
modules/stream_out/rtsp.c
+18
-11
modules/stream_out/vod.c
modules/stream_out/vod.c
+16
-7
No files found.
modules/stream_out/rtp.h
View file @
6ef65eaf
...
@@ -92,7 +92,9 @@ int rtp_get_fmt( vlc_object_t *obj, es_format_t *p_fmt, const char *mux,
...
@@ -92,7 +92,9 @@ int rtp_get_fmt( vlc_object_t *obj, es_format_t *p_fmt, const char *mux,
int
OpenVoD
(
vlc_object_t
*
);
int
OpenVoD
(
vlc_object_t
*
);
void
CloseVoD
(
vlc_object_t
*
);
void
CloseVoD
(
vlc_object_t
*
);
int
vod_play
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int
vod_check_range
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_t
start
,
int64_t
end
);
void
vod_play
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_t
start
,
int64_t
end
,
bool
running
);
int64_t
start
,
int64_t
end
,
bool
running
);
void
vod_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_stop
(
vod_media_t
*
p_media
,
const
char
*
psz_session
);
...
...
modules/stream_out/rtsp.c
View file @
6ef65eaf
...
@@ -954,15 +954,24 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
...
@@ -954,15 +954,24 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
answer
->
i_status
=
457
;
answer
->
i_status
=
457
;
break
;
break
;
}
}
if
(
vod
)
{
if
(
vod_check_range
(
rtsp
->
vod_media
,
psz_session
,
start
,
end
)
!=
VLC_SUCCESS
)
{
answer
->
i_status
=
457
;
break
;
}
}
}
/* We accept start times of 0 even for broadcast streams
/* We accept start times of 0 even for broadcast streams
* that already started */
* that already started */
if
(
!
vod
&&
(
start
>
0
||
end
>=
0
)
)
else
if
(
start
>
0
||
end
>=
0
)
{
{
answer
->
i_status
=
456
;
answer
->
i_status
=
456
;
break
;
break
;
}
}
}
vlc_mutex_lock
(
&
rtsp
->
lock
);
vlc_mutex_lock
(
&
rtsp
->
lock
);
ses
=
RtspClientGet
(
rtsp
,
psz_session
);
ses
=
RtspClientGet
(
rtsp
,
psz_session
);
if
(
ses
!=
NULL
)
if
(
ses
!=
NULL
)
...
@@ -1037,9 +1046,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
...
@@ -1037,9 +1046,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
if
(
vod
)
if
(
vod
)
{
{
bool
running
=
(
sout_id
!=
NULL
);
bool
running
=
(
sout_id
!=
NULL
);
if
(
vod_play
(
rtsp
->
vod_media
,
psz_session
,
start
,
end
,
vod_play
(
rtsp
->
vod_media
,
psz_session
,
start
,
end
,
running
);
running
)
!=
VLC_SUCCESS
)
answer
->
i_status
=
457
;
}
}
}
}
vlc_mutex_unlock
(
&
rtsp
->
lock
);
vlc_mutex_unlock
(
&
rtsp
->
lock
);
...
...
modules/stream_out/vod.c
View file @
6ef65eaf
...
@@ -541,15 +541,26 @@ char *SDPGenerateVoD( const vod_media_t *p_media, const char *rtsp_url )
...
@@ -541,15 +541,26 @@ char *SDPGenerateVoD( const vod_media_t *p_media, const char *rtsp_url )
return
psz_sdp
;
return
psz_sdp
;
}
}
int
vod_check_range
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_t
start
,
int64_t
end
)
{
(
void
)
psz_session
;
if
(
p_media
->
i_length
>
0
&&
(
start
>
p_media
->
i_length
||
end
>
p_media
->
i_length
))
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
}
/* TODO: add support in the VLM for queueing proper PLAY requests with
/* TODO: add support in the VLM for queueing proper PLAY requests with
* start and end times, fetch whether the input is seekable... and then
* start and end times, fetch whether the input is seekable... and then
* clean this up and remove the running argument */
* clean this up and remove the running argument */
int
vod_play
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
void
vod_play
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_t
start
,
int64_t
end
,
bool
running
)
int64_t
start
,
int64_t
end
,
bool
running
)
{
{
if
(
p_media
->
i_length
>
0
&&
(
start
>
p_media
->
i_length
if
(
vod_check_range
(
p_media
,
psz_session
,
start
,
end
)
!=
VLC_SUCCESS
)
||
end
>
p_media
->
i_length
))
return
;
return
VLC_EGENERIC
;
/* We want to seek before unpausing, but it won't
/* We want to seek before unpausing, but it won't
* work if the instance is not running yet. */
* work if the instance is not running yet. */
...
@@ -565,8 +576,6 @@ int vod_play(vod_media_t *p_media, const char *psz_session,
...
@@ -565,8 +576,6 @@ int vod_play(vod_media_t *p_media, const char *psz_session,
/* This is the thing to do to unpause... */
/* This is the thing to do to unpause... */
CommandPush
(
p_media
->
p_vod
,
RTSP_CMD_TYPE_PLAY
,
p_media
,
CommandPush
(
p_media
->
p_vod
,
RTSP_CMD_TYPE_PLAY
,
p_media
,
psz_session
,
0
,
"vod"
);
psz_session
,
0
,
"vod"
);
return
VLC_SUCCESS
;
}
}
void
vod_pause
(
vod_media_t
*
p_media
,
const
char
*
psz_session
)
void
vod_pause
(
vod_media_t
*
p_media
,
const
char
*
psz_session
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment