summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-01-06 14:39:10 +0000
committerrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-01-06 14:39:10 +0000
commitb59db283559b45b184658664985ee791f5bf5d3e (patch)
tree0a8bca3eb27edf433e69bb63302cd88a4ae1c925
parent2f095cc06131e95caff275fefe157fcda796cc99 (diff)
downloadmpv-b59db283559b45b184658664985ee791f5bf5d3e.tar.bz2
mpv-b59db283559b45b184658664985ee791f5bf5d3e.tar.xz
This patch makes real rtsp tell the server to deliver data at specified
bandwidth, if bandwidth cmdline option is given. Also, if that's given, it uses it for sdp stream selection. If not given, the behavior is the same as before. It's used to implement something like turboplay in realplayer. Patch by Tomas Janousek >>> tomi (At) nomi (.) cz <<< git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17333 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/man/en/mplayer.12
-rw-r--r--libmpdemux/realrtsp/real.c12
-rw-r--r--libmpdemux/realrtsp/rtsp.c2
-rw-r--r--libmpdemux/realrtsp/rtsp_session.c3
-rw-r--r--libmpdemux/realrtsp/rtsp_session.h2
5 files changed, 17 insertions, 4 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index d3ec9b664d..24117e3aff 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -946,6 +946,8 @@ amount of memory.
Specify the maximum bandwidth for network streaming (for servers that are
able to send content in different bitrates).
Useful if you want to watch live streamed media behind a slow connection.
+With Real RTSP streaming, it's also used to set maximum delivery bandwidth
+allowing faster cache filling and stream dumping.
.
.TP
.B \-cache <kBytes>
diff --git a/libmpdemux/realrtsp/real.c b/libmpdemux/realrtsp/real.c
index 3d02dd7564..b9989ad065 100644
--- a/libmpdemux/realrtsp/real.c
+++ b/libmpdemux/realrtsp/real.c
@@ -706,12 +706,17 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid
char *mrl=rtsp_get_mrl(rtsp_session);
unsigned int size;
int status;
+ uint32_t maxbandwidth = bandwidth;
/* get challenge */
challenge1=strdup(rtsp_search_answers(rtsp_session,"RealChallenge1"));
#ifdef LOG
printf("real: Challenge1: %s\n", challenge1);
#endif
+
+ /* set a reasonable default to get the best stream, unless bandwidth given */
+ if (!bandwidth)
+ bandwidth = 10485800;
/* request stream description */
rtsp_schedule_field(rtsp_session, "Accept: application/sdp");
@@ -811,6 +816,13 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid
rtsp_schedule_field(rtsp_session, subscribe);
rtsp_request_setparameter(rtsp_session,NULL);
+ /* set delivery bandwidth */
+ if (maxbandwidth) {
+ sprintf(buf, "SetDeliveryBandwidth: Bandwidth=%u;BackOff=0", maxbandwidth);
+ rtsp_schedule_field(rtsp_session, buf);
+ rtsp_request_setparameter(rtsp_session,NULL);
+ }
+
{
int s_ss = 0, s_ms = 0, e_ss = 0, e_ms = 0;
char *str;
diff --git a/libmpdemux/realrtsp/rtsp.c b/libmpdemux/realrtsp/rtsp.c
index 11d7fb9cd7..33dddde248 100644
--- a/libmpdemux/realrtsp/rtsp.c
+++ b/libmpdemux/realrtsp/rtsp.c
@@ -877,7 +877,7 @@ static int realrtsp_streaming_start( stream_t *stream ) {
file++;
mrl = malloc(sizeof(char)*(strlen(stream->streaming_ctrl->url->hostname)+strlen(file)+16));
sprintf(mrl,"rtsp://%s:%i/%s",stream->streaming_ctrl->url->hostname,port,file);
- rtsp = rtsp_session_start(fd,&mrl, file, stream->streaming_ctrl->url->hostname, port, &redirected);
+ rtsp = rtsp_session_start(fd,&mrl, file, stream->streaming_ctrl->url->hostname, port, &redirected, stream->streaming_ctrl->bandwidth);
if( redirected == 1) {
url_free(stream->streaming_ctrl->url);
diff --git a/libmpdemux/realrtsp/rtsp_session.c b/libmpdemux/realrtsp/rtsp_session.c
index 89cd140340..9a4d547d62 100644
--- a/libmpdemux/realrtsp/rtsp_session.c
+++ b/libmpdemux/realrtsp/rtsp_session.c
@@ -71,13 +71,12 @@ struct rtsp_session_s {
};
//rtsp_session_t *rtsp_session_start(char *mrl) {
-rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, int port, int *redir) {
+rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, int port, int *redir, uint32_t bandwidth) {
rtsp_session_t *rtsp_session=malloc(sizeof(rtsp_session_t));
char *server;
char *mrl_line = NULL;
rmff_header_t *h;
- uint32_t bandwidth=10485800;
rtsp_session->recv = xbuffer_init(BUF_SIZE);
diff --git a/libmpdemux/realrtsp/rtsp_session.h b/libmpdemux/realrtsp/rtsp_session.h
index d22788f1c5..4b00511267 100644
--- a/libmpdemux/realrtsp/rtsp_session.h
+++ b/libmpdemux/realrtsp/rtsp_session.h
@@ -30,7 +30,7 @@
typedef struct rtsp_session_s rtsp_session_t;
-rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, int port, int *redir);
+rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, int port, int *redir, uint32_t bandwidth);
int rtsp_session_read(rtsp_session_t *session, char *data, int len);