Originally committed as revision 24389 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -168,12 +168,18 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 168 | 168 |
return -1; |
| 169 | 169 |
|
| 170 | 170 |
if (len > 0) {
|
| 171 |
- int off, out_len; |
|
| 171 |
+ int off, out_len = 0; |
|
| 172 | 172 |
|
| 173 | 173 |
if (len < 4) |
| 174 | 174 |
return -1; |
| 175 | 175 |
|
| 176 |
+ av_freep(&asf->buf); |
|
| 177 |
+ |
|
| 176 | 178 |
init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL); |
| 179 |
+ |
|
| 180 |
+ while (url_ftell(pb) + 4 < len) {
|
|
| 181 |
+ int start_off = url_ftell(pb); |
|
| 182 |
+ |
|
| 177 | 183 |
mflags = get_byte(pb); |
| 178 | 184 |
if (mflags & 0x80) |
| 179 | 185 |
flags |= RTP_FLAG_KEY; |
| ... | ... |
@@ -186,7 +192,6 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 186 | 186 |
url_fskip(pb, 4); |
| 187 | 187 |
off = url_ftell(pb); |
| 188 | 188 |
|
| 189 |
- av_freep(&asf->buf); |
|
| 190 | 189 |
if (!(mflags & 0x40)) {
|
| 191 | 190 |
/** |
| 192 | 191 |
* If 0x40 is not set, the len_off field specifies an offset of this |
| ... | ... |
@@ -206,6 +211,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 206 | 206 |
return AVERROR(EIO); |
| 207 | 207 |
|
| 208 | 208 |
put_buffer(asf->pktbuf, buf + off, len - off); |
| 209 |
+ url_fskip(pb, len - off); |
|
| 209 | 210 |
if (!(flags & RTP_FLAG_MARKER)) |
| 210 | 211 |
return -1; |
| 211 | 212 |
out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); |
| ... | ... |
@@ -218,14 +224,14 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 218 | 218 |
* less in case of packet splitting (i.e. multiple ASF packets in |
| 219 | 219 |
* one RTP packet). |
| 220 | 220 |
*/ |
| 221 |
- if (len_off != len) {
|
|
| 222 |
- av_log_missing_feature(s, |
|
| 223 |
- "RTSP-MS packet splitting", 1); |
|
| 224 |
- return -1; |
|
| 225 |
- } |
|
| 226 |
- asf->buf = av_malloc(len - off); |
|
| 227 |
- out_len = len - off; |
|
| 228 |
- memcpy(asf->buf, buf + off, len - off); |
|
| 221 |
+ |
|
| 222 |
+ int cur_len = start_off + len_off - off; |
|
| 223 |
+ int prev_len = out_len; |
|
| 224 |
+ out_len += cur_len; |
|
| 225 |
+ asf->buf = av_realloc(asf->buf, out_len); |
|
| 226 |
+ memcpy(asf->buf + prev_len, buf + off, cur_len); |
|
| 227 |
+ url_fskip(pb, cur_len); |
|
| 228 |
+ } |
|
| 229 | 229 |
} |
| 230 | 230 |
|
| 231 | 231 |
init_packetizer(pb, asf->buf, out_len); |