mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-26 04:59:30 +08:00
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:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user