[FFmpeg-devel] [PATCH] RTSP-MS 14/15: ASF packet parsing

Luca Abeni lucabe72
Wed Apr 22 09:21:18 CEST 2009

Hi Ronald,

Ronald S. Bultje wrote:
> OK, so let's head on to the complex stuff now. Attached is the same
> patch as last time, now using url_*_dyn_buf() instead of that
> ff_rtp_merge_data_packet() function (thanks Luca A.!), no need to
> review because it still has the same issue as per above.
> OK, let's answer this question so that we can decide what to do next
> to solve this issue. So the invalid state (EOF) is reached because I
> feed the demuxer individual packets, which naturally reach
> end-of-buffer ("EOF") at the end of each packet rather than only at
> the end of a file.

I do not know ASF, nor the RTP ASF packetisation by microsoft, nor I
know this "EOF" problem, so I cannot comment on it...

Regarding the payload buffer, the patch looks better than the last one,
but the code still looks quite convoluted:
+        if (!(mflags & 0x40)) {
+            if (!len_off && !asf->pktbuf) {
+                if (!(res = url_open_dyn_buf(&asf->pktbuf)))
+                    return res;
+            } else if (len_off != url_ftell(asf->pktbuf)) {
+                uint8_t *p;
+                url_close_dyn_buf(asf->pktbuf, &p);
+        } else {
+            asf->buf = av_malloc(len - off);
+            asf->pos = len - off;
+            memcpy(asf->buf, buf + off, len - off);
+        }

Unless microsoft is using standard headers and flags in a very
non-standard way, I think this code can be written in a much
simpler way.


More information about the ffmpeg-devel mailing list