diff options
author | Clément Bœsch <clement.boesch@smartjog.com> | 2012-01-02 09:39:11 +0100 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-01-02 15:34:03 +0100 |
commit | e1a8164d62fb8d1943b3f7a66500f0315ca8fe76 (patch) | |
tree | d321b32721c9a9b58080949fdeedb880f06e81a7 /libavformat/mp3enc.c | |
parent | 940d3cc0b0762f8beb8a12542e7553c17032ed3d (diff) | |
download | ffmpeg-e1a8164d62fb8d1943b3f7a66500f0315ca8fe76.tar.gz |
mp3enc: fix playback with mp3 encoded files on some devices.
This partially reverts 1fea432b; header variable needs to keep its value
in case it triggers "if (needed <= c.frame_size)".
Diffstat (limited to 'libavformat/mp3enc.c')
-rw-r--r-- | libavformat/mp3enc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 42fc39db96..8d82452689 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -160,7 +160,7 @@ static int mp3_write_xing(AVFormatContext *s) int best_bitrate_idx; int best_bitrate_error= INT_MAX; int64_t xing_offset; - int32_t header; + int32_t header, mask; MPADecodeHeader c; int srate_idx, i, channels; int needed; @@ -200,8 +200,9 @@ static int mp3_write_xing(AVFormatContext *s) for (bitrate_idx= best_bitrate_idx;; bitrate_idx++) { if (15 == bitrate_idx) return -1; - - avpriv_mpegaudio_decode_header(&c, header | (bitrate_idx << (4+8))); + mask = bitrate_idx << (4+8); + header |= mask; + avpriv_mpegaudio_decode_header(&c, header); xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1]; needed = 4 // header + xing_offset @@ -213,6 +214,7 @@ static int mp3_write_xing(AVFormatContext *s) if (needed <= c.frame_size) break; + header &= ~mask; } avio_wb32(s->pb, header); |