[FFmpeg-devel] [PATCH] gxf only read valid audio samples

Baptiste Coudurier baptiste.coudurier
Wed Sep 24 18:58:47 CEST 2008


Hi Reimar,

Reimar D?ffinger wrote:
> Hello,
> it's been a long time since I read the spec, so I might be wrong in
> details but I still think most applies..
> 
> On Tue, Sep 23, 2008 at 06:00:40PM -0700, Baptiste Coudurier wrote:
>> -        // NOTE: there is also data length information in the
>> -        // field information, it might be better to take this into account
>> -        // as well.
>> +        if (st->codec->codec_id == CODEC_ID_PCM_S24LE ||
>> +            st->codec->codec_id == CODEC_ID_PCM_S16LE) {
>> +            int first = field_info >> 16;
>> +            int last  = field_info & 0xffff;
>> +            int bps = av_get_bits_per_sample(st->codec->codec_id)>>3;
>> +            pkt_len = last*bps;
>> +            if (first) {
>> +                url_fskip(pb, first*bps);
>> +                pkt_len -= first*bps;
>> +            }
> 
> This should do something half-sane for first > last
> 
>> +            skip = (32768-last)*bps;
> 
> This should be the original pkt_len minus the new pkt_len and what we
> already skipped.
> Also IMO the original pkt_len should take priority in case
> last*bps > original packet length.
> I guess a easy way would be to just ignore field info (preferably with
> an error message) if first > last or last * bps > pkt_len.

Ok, patch updated.

> Btw. I am not sure "last" is such a good name, since at least the way
> you use it, it is the sample after the last, so "num_samples" (or
> something better if you find one).
> 

Dunno, I used specs names:
"For audio and time code, the field information contains the first valid
sample number (inclusive) and the last valid sample number (exclusive).
The first and last valid sample numbers apply to the current packet only."

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gxf_skip_nonvalid_audio2.patch
Type: text/x-diff
Size: 1909 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080924/600f13fc/attachment.patch>



More information about the ffmpeg-devel mailing list