Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: media/formats/mpeg/mpeg_audio_stream_parser_base.cc

Issue 2378443002: Fix MSE ADTS parsing on Android. (Closed)
Patch Set: Address comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mpeg/mpeg_audio_stream_parser_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mpeg/mpeg_audio_stream_parser_base.cc
diff --git a/media/formats/mpeg/mpeg_audio_stream_parser_base.cc b/media/formats/mpeg/mpeg_audio_stream_parser_base.cc
index 0429a74f6e57373bc3268cf6568c372f6a95fc88..093d863011b250b0063a5d6d586833f3ff1c6bd0 100644
--- a/media/formats/mpeg/mpeg_audio_stream_parser_base.cc
+++ b/media/formats/mpeg/mpeg_audio_stream_parser_base.cc
@@ -179,13 +179,10 @@ int MPEGAudioStreamParserBase::ParseFrame(const uint8_t* data,
int frame_size;
int sample_count;
bool metadata_frame = false;
- int bytes_read = ParseFrameHeader(data,
- size,
- &frame_size,
- &sample_rate,
- &channel_layout,
- &sample_count,
- &metadata_frame);
+ std::vector<uint8_t> extra_data;
+ int bytes_read =
+ ParseFrameHeader(data, size, &frame_size, &sample_rate, &channel_layout,
+ &sample_count, &metadata_frame, &extra_data);
if (bytes_read <= 0)
return bytes_read;
@@ -194,14 +191,12 @@ int MPEGAudioStreamParserBase::ParseFrame(const uint8_t* data,
if (size < frame_size)
return 0;
- DVLOG(2) << " sample_rate " << sample_rate
- << " channel_layout " << channel_layout
- << " frame_size " << frame_size
- << " sample_count " << sample_count;
+ DVLOG(2) << " sample_rate " << sample_rate << " channel_layout "
+ << channel_layout << " frame_size " << frame_size << " sample_count "
+ << sample_count;
- if (config_.IsValidConfig() &&
- (config_.samples_per_second() != sample_rate ||
- config_.channel_layout() != channel_layout)) {
+ if (config_.IsValidConfig() && (config_.samples_per_second() != sample_rate ||
+ config_.channel_layout() != channel_layout)) {
// Clear config data so that a config change is initiated.
config_ = AudioDecoderConfig();
@@ -212,7 +207,7 @@ int MPEGAudioStreamParserBase::ParseFrame(const uint8_t* data,
if (!config_.IsValidConfig()) {
config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout,
- sample_rate, std::vector<uint8_t>(), Unencrypted(),
+ sample_rate, extra_data, Unencrypted(),
base::TimeDelta(), codec_delay_);
base::TimeDelta base_timestamp;
@@ -301,10 +296,8 @@ int MPEGAudioStreamParserBase::ParseID3v2(const uint8_t* data, int size) {
uint8_t flags;
int32_t id3_size;
- if (!reader.ReadBits(24, &id) ||
- !reader.ReadBits(16, &version) ||
- !reader.ReadBits(8, &flags) ||
- !ParseSyncSafeInt(&reader, &id3_size)) {
+ if (!reader.ReadBits(24, &id) || !reader.ReadBits(16, &version) ||
+ !reader.ReadBits(8, &flags) || !ParseSyncSafeInt(&reader, &id3_size)) {
return -1;
}
@@ -363,8 +356,8 @@ int MPEGAudioStreamParserBase::FindNextValidStartCode(const uint8_t* data,
for (int i = 0; i < 3; ++i) {
int sync_size = end - sync;
int frame_size;
- int sync_bytes = ParseFrameHeader(
- sync, sync_size, &frame_size, NULL, NULL, NULL, NULL);
+ int sync_bytes = ParseFrameHeader(sync, sync_size, &frame_size, nullptr,
+ nullptr, nullptr, nullptr, nullptr);
if (sync_bytes == 0)
return 0;
« no previous file with comments | « media/formats/mpeg/mpeg_audio_stream_parser_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698