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

Ronald S. Bultje rsbultje
Sat Apr 18 16:27:21 CEST 2009


Hi,

On Sat, Apr 18, 2009 at 12:03 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Apr 17, 2009 at 10:17:20PM -0400, Ronald S. Bultje wrote:
>> I'll go add some padding to packets so it works, or maybe just change
>> min_pktsize in the header to 0... Who knows.
>
> thank you (in case this solves the problem)

I can confirm that setting min_pktsize to zero fixes the issue. I can
do two things now:
- add code to rtp_asf.c to parse the ASF header until a file_header is
found and update the buffer
- parse the buffer, and afterwards examine (in rtp_asf.c again)
ASFDemuxContext->min_pktsize and set it to zero if it is the same as
max_pktsize

I assume you prefer (1) because (2) makes assumptions on demuxer state
during/after header parsing? Attached patch does that. I can make it
use ByteIOContext if you prefer but this seemed simpler to me... Also,
still one change is required in asfdec.c (the EOF) because otherwise
we read nonsensical information into packet_size_left (because we're
reading past EOF, thus all calls in this function to get_byte() etc.
return 0). If you have any ideas on how to fix that w/o changing
asfdec.c, let me know.

(After this is in, I'll undo the non-static-making of
get_packet/parse_packet in asfdec.c.)

Ronald
-------------- next part --------------
Index: libavformat/asfdec.c
===================================================================
--- libavformat/asfdec.c	(revision 18531)
+++ libavformat/asfdec.c	(working copy)
@@ -715,7 +715,7 @@
             asf->packet_pos= url_ftell(pb);
             if (asf->data_object_size != (uint64_t)-1 &&
                 (asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
-                return AVERROR(EIO); /* Do not exceed the size of the data object */
+                return AVERROR_EOF; /* Do not exceed the size of the data object */
             return 1;
         }
         if (asf->packet_time_start == 0) {



More information about the ffmpeg-devel mailing list