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
commitab736e117354a3022177213ffcc7dce49c681249 (patch)
tree451f791c3b08893921012068634f99b8484a3547 /media/libstagefright/avc_utils.cpp
parent28169b107327b5db58877babf6993f0eb109c58a (diff)
downloadframeworks_av-ab736e117354a3022177213ffcc7dce49c681249.zip
frameworks_av-ab736e117354a3022177213ffcc7dce49c681249.tar.gz
frameworks_av-ab736e117354a3022177213ffcc7dce49c681249.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;
}
}