[FFmpeg-devel] [PATCH] fix the SAMPLE_FMT_NONE case in ffmdec.c

Bobby Bingham uhmmmm
Wed Mar 17 01:08:27 CET 2010


On Tue, 16 Mar 2010 16:38:44 +0000
M?ns Rullg?rd <mans at mansr.com> wrote:
[...]
> >>              codec->sample_rate = get_be32(pb);
> >>              codec->channels = get_le16(pb);
> >>              codec->frame_size = get_le16(pb);
> >> -            codec->sample_fmt = get_le16(pb);
> >> +            codec->sample_fmt = sign_extend(get_le16(pb), 16);
> >
> > a simple cast to int16_t seems simpler
> 
> Strictly speaking, that is undefined, but I don't think we care,

Could you explain why is this undefined?  My initial guess was that
you're not guaranteed that signed integers two's complement, but I
thought you were guaranteed that for the fixed-width C99 int types.

> especially considering the default sign_extend() implementation also
> has undefined behaviour.
> 


-- 
Bobby Bingham
??????????????????????



More information about the ffmpeg-devel mailing list