summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/avc_utils.cpp
diff options
context:
space:
mode:
authorJohn Grossman <johngro@google.com>2012-08-29 14:51:01 -0700
committerJohn Grossman <johngro@google.com>2012-09-06 10:18:38 -0700
commita39ad61a1c9c69c2cc60f5d14243dd56040f8571 (patch)
tree244c5a5b7629f21a86a31a51afbad1ad91c3a124 /media/libstagefright/avc_utils.cpp
parent0b73d4730202fcad53aefc4314a06e7b95f442f0 (diff)
downloadframeworks_av-a39ad61a1c9c69c2cc60f5d14243dd56040f8571.zip
frameworks_av-a39ad61a1c9c69c2cc60f5d14243dd56040f8571.tar.gz
frameworks_av-a39ad61a1c9c69c2cc60f5d14243dd56040f8571.tar.bz2
Fix calculations for an obscure combo of MPEG audio options.
MPEGv2 and MPEGv2.5 Layer 2 audio payloads should 1152 samples per access unit, not 576. Adjust the frame size and samples out calculations accordingly. Also, adjust the max frame size in the MP3Extractor's MediaSource to be closer to the theoretical worst case max frame size. The theoretical worst case for MPEG audio is 2881 bytes per frame, but the max frame size being used was 32kB. It has been changed to be 4kB in order to remain a power of 2 allocation, but to be the power of 2 closest to the worst case. Change-Id: If11f5a843b06e70151bbe8298cc54f954938d9d7
Diffstat (limited to 'media/libstagefright/avc_utils.cpp')
-rw-r--r--media/libstagefright/avc_utils.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index 65c1848..a141752 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -600,7 +600,7 @@ bool GetMPEGAudioFrameSize(
bitrate = kBitrateV2[bitrate_index - 1];
if (out_num_samples) {
- *out_num_samples = 576;
+ *out_num_samples = (layer == 1 /* L3 */) ? 576 : 1152;
}
}
@@ -612,7 +612,8 @@ bool GetMPEGAudioFrameSize(
*frame_size = 144000 * bitrate / sampling_rate + padding;
} else {
// V2 or V2.5
- *frame_size = 72000 * bitrate / sampling_rate + padding;
+ size_t tmp = (layer == 1 /* L3 */) ? 72000 : 144000;
+ *frame_size = tmp * bitrate / sampling_rate + padding;
}
}