aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-25 02:17:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-25 02:17:37 +0100
commit4dbdd3ec6f4a5c7d8e4f3cfe0f564bb14a77503c (patch)
tree330cd1deed9bf72d19d728d22c371de0459bfa5a
parent1e44dda825c9d9edd55d53c5aff74f60f8fbedf9 (diff)
downloadffmpeg-4dbdd3ec6f4a5c7d8e4f3cfe0f564bb14a77503c.tar.gz
mp3enc: fix "warning: best_bitrate_idx may be used uninitialized in this function"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mp3enc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 8d82452689..3bbc3e84f9 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -35,6 +35,7 @@
#include "libavcodec/mpegaudiodecheader.h"
#include "libavformat/avio_internal.h"
#include "libavutil/dict.h"
+#include "libavutil/avassert.h"
static int id3v1_set_string(AVFormatContext *s, const char *key,
uint8_t *buf, int buf_size)
@@ -157,7 +158,7 @@ static int mp3_write_xing(AVFormatContext *s)
AVCodecContext *codec = s->streams[0]->codec;
MP3Context *mp3 = s->priv_data;
int bitrate_idx;
- int best_bitrate_idx;
+ int best_bitrate_idx = -1;
int best_bitrate_error= INT_MAX;
int64_t xing_offset;
int32_t header, mask;
@@ -196,6 +197,7 @@ static int mp3_write_xing(AVFormatContext *s)
best_bitrate_idx = bitrate_idx;
}
}
+ av_assert0(best_bitrate_idx >= 0);
for (bitrate_idx= best_bitrate_idx;; bitrate_idx++) {
if (15 == bitrate_idx)