| Index: media/formats/mpeg/adts_stream_parser.cc
|
| diff --git a/media/formats/mpeg/adts_stream_parser.cc b/media/formats/mpeg/adts_stream_parser.cc
|
| index c6543047f94aa9f9edbe2757da357940bb03469c..a24c17f2abcfc859cfb1609ead0532b6a9e427e6 100644
|
| --- a/media/formats/mpeg/adts_stream_parser.cc
|
| +++ b/media/formats/mpeg/adts_stream_parser.cc
|
| @@ -6,7 +6,9 @@
|
|
|
| #include <stddef.h>
|
|
|
| +#include "build/build_config.h"
|
| #include "media/base/media_log.h"
|
| +#include "media/formats/mp4/aac.h"
|
| #include "media/formats/mpeg/adts_constants.h"
|
|
|
| namespace media {
|
| @@ -24,7 +26,8 @@ int ADTSStreamParser::ParseFrameHeader(const uint8_t* data,
|
| int* sample_rate,
|
| ChannelLayout* channel_layout,
|
| int* sample_count,
|
| - bool* metadata_frame) const {
|
| + bool* metadata_frame,
|
| + std::vector<uint8_t>* extra_data) const {
|
| DCHECK(data);
|
| DCHECK_GE(size, 0);
|
| DCHECK(frame_size);
|
| @@ -95,6 +98,22 @@ int ADTSStreamParser::ParseFrameHeader(const uint8_t* data,
|
| if (metadata_frame)
|
| *metadata_frame = false;
|
|
|
| +// Only Android needs this extra data to be passed.
|
| +#if defined(OS_ANDROID)
|
| + if (extra_data) {
|
| + // See mp4::AAC::Parse() for details. We don't need to worry about writing
|
| + // extensions since we can't have extended ADTS by this point (it's
|
| + // explicitly rejected as invalid above).
|
| + DCHECK_NE(sample_rate_index, 15u);
|
| + const uint16_t esds = (((((profile + 1) << 4) + sample_rate_index) << 4) +
|
| + channel_layout_index)
|
| + << 3;
|
| + extra_data->push_back((esds & 0xFF00) >> 8);
|
| + extra_data->push_back(esds & 0x00FF);
|
| + DCHECK(mp4::AAC().Parse(*extra_data, media_log()));
|
| + }
|
| +#endif
|
| +
|
| return bytes_read;
|
| }
|
|
|
|
|