id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
1718	MP3 parser get frame_size wrong	adam_csheng		"Summary of the bug:[[BR]]
MP3 parser get the frame_size wrong when playback,
the second and third frame_size are wrong.[[BR]]
How to reproduce:
{{{
ffprobe -show_packets $FILENAME[[BR]]
The first packet is right, packet size is 488
[PACKET]
codec_type=audio
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=384
duration_time=0.008707
convergence_duration=N/A
convergence_duration_time=N/A
size=488
pos=167471
flags=K
[/PACKET]
The second packet size is wrong: 333
[PACKET]
codec_type=audio
stream_index=0
pts=383
pts_time=0.008685
dts=383
dts_time=0.008685
duration=384
duration_time=0.008707
convergence_duration=N/A
convergence_duration_time=N/A
size=333
pos=167959
flags=K
[/PACKET]
And the third packets is wrong:643
[PACKET]
codec_type=audio
stream_index=0
pts=767
pts_time=0.017392
dts=767
dts_time=0.017392
duration=384
duration_time=0.008707
convergence_duration=N/A
convergence_duration_time=N/A
size=643
pos=N/A
flags=K
[/PACKET]
The fourth packets is right:488
[PACKET]
codec_type=audio
stream_index=0
pts=1151
pts_time=0.026100
dts=1151
dts_time=0.026100
duration=384
duration_time=0.008707
convergence_duration=N/A
convergence_duration_time=N/A
size=488
pos=168935
flags=K
[/PACKET]

Analysis:
As the first packet get the pc->state is 0xFFFFE275.
When parser the second packet, the first four bytes is 0xFFFFE205,
then get the state is 0xFFE205FF when only use the first second packet byte 0xFF
by state= (state<<8) + buf[i++];
Then get the wrong MP3 header for this file but it's a valid MP3 frame header.
}}}"	defect	closed	normal	avcodec	git-master	fixed	mp3 mp1 parser				1	0
