[FFmpeg-devel] [PATCH] raw_read_header fix

Alex Beregszaszi alex
Sat Jul 14 03:50:16 CEST 2007


Hi,

> > Well, if try_decode_frame fails, why shouldn't we give up? And ulaw/alaw
> > decoder should fail if no sampling rate is specified as there is no way
> > for storing such information in the format itself.
> 
> True, but how is the calling app to know that the format lacks this
> information beforehand?

We can anyway make assumptions, but imho codec_init should reply an
error like insufficient codec configuration.

The attached patch solves different problems, but now in the end this
works nicely here.

av_valid_q might be wrong at assuming numerator should be >= 0, but imho
in mathematics.c there were some assertions about this. We surely don't
want a negative time_base, right?

av_valid_q is just a helper, might be of use.

pcm.diff adds checks into pcm.c to bail out when no sampling rate or
channels are set, as itself cannot fill those fields out.

trydecode.diff is really noisy, it can be splitted into more parts too.
First, the ret is checked for after this loop, and it might come handy
to have the latest error code checked.

+            ret = try_decode_frame(st, pkt->data, pkt->size);
+//            if (!st->codec->codec)
+//                break;

If st->codec->codec is zero after try_decode_frame, that means the codec
init failed. In this case we should give up in any case imho. We cant
influence after this part the codec init any further.

The check below uses assumes that the loop will read 60 seconds of data
(hence max_analyze_duration/60) and we should run the loop at most
max_analyze_duration/60 times if the time_base is not yet correctly set,
thus we can't calculate real timestamps to see whether we reached that
max_analyze_duration threshold or not.

Michael, can you finally clean up the noise we generated? :)

--
Alex

-------------- next part --------------
A non-text attachment was scrubbed...
Name: av_valid.diff
Type: text/x-patch
Size: 696 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070714/25eb56d3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm.diff
Type: text/x-patch
Size: 370 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070714/25eb56d3/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trydecode.diff
Type: text/x-patch
Size: 1120 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070714/25eb56d3/attachment-0002.bin>



More information about the ffmpeg-devel mailing list