[FFmpeg-devel] [patch] 6 channel rawaudioinputresultsin invalid PCM packet error

Michael Niedermayer michaelni
Mon Nov 10 19:19:32 CET 2008


On Mon, Nov 10, 2008 at 09:57:03AM -0800, Phil Rutschman wrote:
> > bits_per_coded_sample could be set in raw_read_header() it would at
> > least avoid recalculating its value in every packet
> 
> Done. bits_per_coded_sample is set to av_get_bits_per_sample() unless
> the latter returns zero, in which case it's set to 8. Alternatively I
> could error or assert on a zero return value, which should never happen
> with raw audio.

setting it to 8 if av_get_bits_per_sample() returns 0 does seem rather
wrong.


[...]
> @@ -135,14 +137,19 @@
>  }
>  
>  #define RAW_PACKET_SIZE 1024
> +#define RAW_MAX_CHANNELS 20
>  
>  static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>      int ret, size, bps;
> -    //    AVStream *st = s->streams[0];
> +    AVStream *st = s->streams[0];
>  
>      size= RAW_PACKET_SIZE;
>  
> +    if (st->codec->channels > 0 && st->codec->channels <= RAW_MAX_CHANNELS) {

> +	    size *= st->codec->bits_per_coded_sample*st->codec->channels / 8;

tabs are forbiden in ffmpeg svn

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081110/0a31a8e2/attachment.pgp>



More information about the ffmpeg-devel mailing list