aboutsummaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer2014-06-23 03:34:13 +0200
committerMichael Niedermayer2014-06-23 03:34:13 +0200
commitca350378de061a43d394dab2a649995f7f83274c (patch)
treeb30092dc6dcd9d1b1600e184a9820b1c7ccef554 /libavformat
parent2bcf34a0ef60b8026d9f10fafda9b61ad302b85a (diff)
parentf2f2e7627f0c878d13275af5d166ec5932665e28 (diff)
Merge commit 'f2f2e7627f0c878d13275af5d166ec5932665e28'
* commit 'f2f2e7627f0c878d13275af5d166ec5932665e28': Check mp3 header before calling avpriv_mpegaudio_decode_header(). Conflicts: libavformat/mp3enc.c See: 2dd0da787ce5008d4d1b8f461fbd1288c32e2c38 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mp3enc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 43f7656314..c0270c21db 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -262,19 +262,19 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
if (pkt->data && pkt->size >= 4) {
MPADecodeHeader mpah;
int av_unused base;
- uint32_t head = AV_RB32(pkt->data);
-
- if (ff_mpa_check_header(head) < 0) {
+ uint32_t h;
+
+ h = AV_RB32(pkt->data);
+ if (ff_mpa_check_header(h) == 0) {
+ avpriv_mpegaudio_decode_header(&mpah, h);
+ if (!mp3->initial_bitrate)
+ mp3->initial_bitrate = mpah.bit_rate;
+ if ((mpah.bit_rate == 0) || (mp3->initial_bitrate != mpah.bit_rate))
+ mp3->has_variable_bitrate = 1;
+ } else {
av_log(s, AV_LOG_WARNING, "Audio packet of size %d (starting with %08X...) "
- "is invalid, writing it anyway.\n", pkt->size, head);
- return ff_raw_write_packet(s, pkt);
+ "is invalid, writing it anyway.\n", pkt->size, h);
}
- avpriv_mpegaudio_decode_header(&mpah, head);
-
- if (!mp3->initial_bitrate)
- mp3->initial_bitrate = mpah.bit_rate;
- if ((mpah.bit_rate == 0) || (mp3->initial_bitrate != mpah.bit_rate))
- mp3->has_variable_bitrate = 1;
#ifdef FILTER_VBR_HEADERS
/* filter out XING and INFO headers. */