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
This commit is contained in:
rtognimp
2006-01-06 14:39:10 +00:00
parent 2f095cc061
commit b59db28355
5 changed files with 17 additions and 4 deletions
+2
View File
@@ -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>
+12
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -2
View File
@@ -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);
+1 -1
View File
@@ -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);