Loading media/libstagefright/MP3Extractor.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ protected: virtual ~MP3Source(); private: static const size_t kMaxFrameSize; sp<MetaData> mMeta; sp<DataSource> mDataSource; off64_t mFirstFramePos; Loading Loading @@ -405,6 +406,13 @@ sp<MetaData> MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) { //////////////////////////////////////////////////////////////////////////////// // The theoretical maximum frame size for an MPEG audio stream should occur // while playing a Layer 2, MPEGv2.5 audio stream at 160kbps (with padding). // The size of this frame should be... // ((1152 samples/frame * 160000 bits/sec) / // (8000 samples/sec * 8 bits/byte)) + 1 padding byte/frame = 2881 bytes/frame. // Set our max frame size to the nearest power of 2 above this size (aka, 4kB) const size_t MP3Source::kMaxFrameSize = (1 << 12); /* 4096 bytes */ MP3Source::MP3Source( const sp<MetaData> &meta, const sp<DataSource> &source, off64_t first_frame_pos, uint32_t fixed_header, Loading Loading @@ -433,7 +441,6 @@ status_t MP3Source::start(MetaData *) { mGroup = new MediaBufferGroup; const size_t kMaxFrameSize = 32768; mGroup->add_buffer(new MediaBuffer(kMaxFrameSize)); mCurrentPos = mFirstFramePos; Loading media/libstagefright/avc_utils.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -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; } } Loading @@ -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; } } Loading Loading
media/libstagefright/MP3Extractor.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ protected: virtual ~MP3Source(); private: static const size_t kMaxFrameSize; sp<MetaData> mMeta; sp<DataSource> mDataSource; off64_t mFirstFramePos; Loading Loading @@ -405,6 +406,13 @@ sp<MetaData> MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) { //////////////////////////////////////////////////////////////////////////////// // The theoretical maximum frame size for an MPEG audio stream should occur // while playing a Layer 2, MPEGv2.5 audio stream at 160kbps (with padding). // The size of this frame should be... // ((1152 samples/frame * 160000 bits/sec) / // (8000 samples/sec * 8 bits/byte)) + 1 padding byte/frame = 2881 bytes/frame. // Set our max frame size to the nearest power of 2 above this size (aka, 4kB) const size_t MP3Source::kMaxFrameSize = (1 << 12); /* 4096 bytes */ MP3Source::MP3Source( const sp<MetaData> &meta, const sp<DataSource> &source, off64_t first_frame_pos, uint32_t fixed_header, Loading Loading @@ -433,7 +441,6 @@ status_t MP3Source::start(MetaData *) { mGroup = new MediaBufferGroup; const size_t kMaxFrameSize = 32768; mGroup->add_buffer(new MediaBuffer(kMaxFrameSize)); mCurrentPos = mFirstFramePos; Loading
media/libstagefright/avc_utils.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -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; } } Loading @@ -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; } } Loading