diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-09-04 19:49:35 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-09-04 19:49:35 +0300 |
commit | 0e1b7765be878491565cf5e471f22b15e106164c (patch) | |
tree | 422e500c289335182a2a64934dcabf10b95e32dc /stream | |
parent | a9618c1c6fe9424dfaeb1677348e0382d7252554 (diff) | |
parent | dcfd043ea8d0c46929aad78596314d837c290d39 (diff) | |
download | mpv-0e1b7765be878491565cf5e471f22b15e106164c.tar.bz2 mpv-0e1b7765be878491565cf5e471f22b15e106164c.tar.xz |
Merge svn changes up to r29644
Diffstat (limited to 'stream')
-rw-r--r-- | stream/librtsp/rtsp_session.c | 8 | ||||
-rw-r--r-- | stream/realrtsp/asmrp.c | 1 | ||||
-rw-r--r-- | stream/realrtsp/real.c | 32 | ||||
-rw-r--r-- | stream/realrtsp/rmff.c | 2 | ||||
-rw-r--r-- | stream/realrtsp/sdpplin.c | 1 |
5 files changed, 26 insertions, 18 deletions
diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c index 8b87d7fb41..33c36f15b9 100644 --- a/stream/librtsp/rtsp_session.c +++ b/stream/librtsp/rtsp_session.c @@ -94,6 +94,7 @@ static void rtsp_close(rtsp_t *s) { if (s->mrl) free(s->mrl); if (s->session) free(s->session); if (s->user_agent) free(s->user_agent); + free(s->server); rtsp_free_answers(s); rtsp_unschedule_all(s); free(s); @@ -106,7 +107,6 @@ rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, rtsp_session_t *rtsp_session = NULL; char *server; char *mrl_line = NULL; - rmff_header_t *h; rtsp_session = malloc (sizeof (rtsp_session_t)); rtsp_session->s = NULL; @@ -138,8 +138,9 @@ rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, { /* we are talking to a real server ... */ - h=real_setup_and_get_header(rtsp_session->s, bandwidth, user, pass); - if (!h) { + rmff_header_t *h=real_setup_and_get_header(rtsp_session->s, bandwidth, user, pass); + if (!h || !h->streams[0]) { + rmff_free_header(h); /* got an redirect? */ if (rtsp_search_answers(rtsp_session->s, RTSP_OPTIONS_LOCATION)) { @@ -195,6 +196,7 @@ rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host, rtsp_session->real_session->header_len; } rtsp_session->real_session->recv_read = 0; + rmff_free_header(h); } else /* not a Real server : try RTP instead */ { char *public = NULL; diff --git a/stream/realrtsp/asmrp.c b/stream/realrtsp/asmrp.c index aafe76719c..bcbe1c9389 100644 --- a/stream/realrtsp/asmrp.c +++ b/stream/realrtsp/asmrp.c @@ -116,6 +116,7 @@ static void asmrp_dispose (asmrp_t *p) { for (i=0; i<p->sym_tab_num; i++) free (p->sym_tab[i].id); + free(p->buf); free (p); } diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c index b8f943c8e0..cad231dedd 100644 --- a/stream/realrtsp/real.c +++ b/stream/realrtsp/real.c @@ -235,6 +235,8 @@ static rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t b char b[64]; int rulematches[MAX_RULEMATCHES]; + if (!desc->stream[i]) + continue; #ifdef LOG printf("calling asmrp_match with:\n%s\n%u\n", desc->stream[i]->asm_rule_book, bandwidth); #endif @@ -249,7 +251,7 @@ static rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t b if (!desc->stream[i]->mlti_data) { len = 0; - buf = NULL; + buf = xbuffer_free(buf); } else len=select_mlti_data(desc->stream[i]->mlti_data, desc->stream[i]->mlti_data_size, rulematches[0], &buf); @@ -427,11 +429,11 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwidt char *description=NULL; char *session_id=NULL; - rmff_header_t *h; - char *challenge1; + rmff_header_t *h = NULL; + char *challenge1 = NULL; char challenge2[41]; char checksum[9]; - char *subscribe; + char *subscribe = NULL; char *buf = xbuffer_init(256); char *mrl=rtsp_get_mrl(rtsp_session); unsigned int size; @@ -441,7 +443,10 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwidt int i; /* get challenge */ - challenge1=strdup(rtsp_search_answers(rtsp_session,"RealChallenge1")); + challenge1=rtsp_search_answers(rtsp_session,"RealChallenge1"); + if (!challenge1) + goto out; + challenge1=strdup(challenge1); #ifdef LOG printf("real: Challenge1: %s\n", challenge1); #endif @@ -513,8 +518,7 @@ autherr: alert); } rtsp_send_ok(rtsp_session); - buf = xbuffer_free(buf); - return NULL; + goto out; } /* receive description */ @@ -528,8 +532,7 @@ autherr: if (size > MAX_DESC_BUF) { mp_msg(MSGT_STREAM, MSGL_ERR, "realrtsp: Content-length for description too big (> %uMB)!\n", MAX_DESC_BUF/(1024*1024) ); - xbuffer_free(buf); - return NULL; + goto out; } if (!rtsp_search_answers(rtsp_session,"ETag")) @@ -544,8 +547,7 @@ autherr: description=malloc(size+1); if( rtsp_read_data(rtsp_session, description, size) <= 0) { - buf = xbuffer_free(buf); - return NULL; + goto out; } description[size]=0; @@ -554,9 +556,7 @@ autherr: strcpy(subscribe, "Subscribe: "); h=real_parse_sdp(description, &subscribe, bandwidth); if (!h) { - subscribe = xbuffer_free(subscribe); - buf = xbuffer_free(buf); - return NULL; + goto out; } rmff_fix_header(h); @@ -619,8 +619,12 @@ autherr: /* and finally send a play request */ rtsp_request_play(rtsp_session,NULL); +out: subscribe = xbuffer_free(subscribe); buf = xbuffer_free(buf); + free(description); + free(session_id); + free(challenge1); return h; } diff --git a/stream/realrtsp/rmff.c b/stream/realrtsp/rmff.c index b98ccd9377..e147b76f36 100644 --- a/stream/realrtsp/rmff.c +++ b/stream/realrtsp/rmff.c @@ -570,7 +570,7 @@ rmff_mdpr_t *rmff_new_mdpr( uint32_t type_specific_len, const char *type_specific_data ) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr=calloc(sizeof(rmff_mdpr_t),1); mdpr->object_id=MDPR_TAG; mdpr->object_version=0; diff --git a/stream/realrtsp/sdpplin.c b/stream/realrtsp/sdpplin.c index 5d68d4f397..fe561f4082 100644 --- a/stream/realrtsp/sdpplin.c +++ b/stream/realrtsp/sdpplin.c @@ -376,6 +376,7 @@ void sdpplin_free(sdpplin_t *description) { free(description->stream[i]->mlti_data); if (description->stream[i]->asm_rule_book) free(description->stream[i]->asm_rule_book); + free(description->stream[i]->id); free(description->stream[i]); } } |