Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/formats/mpeg/adts_stream_parser.h" | 5 #include "media/formats/mpeg/adts_stream_parser.h" |
| 6 | 6 |
| 7 #include "media/formats/mpeg/adts_constants.h" | 7 #include "media/formats/mpeg/adts_constants.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 << " version 0x" << version | 62 << " version 0x" << version |
| 63 << " layer 0x" << layer | 63 << " layer 0x" << layer |
| 64 << " profile 0x" << profile | 64 << " profile 0x" << profile |
| 65 << " sample_rate_index 0x" << sample_rate_index | 65 << " sample_rate_index 0x" << sample_rate_index |
| 66 << " channel_layout_index 0x" << channel_layout_index; | 66 << " channel_layout_index 0x" << channel_layout_index; |
| 67 | 67 |
| 68 const int bytes_read = reader.bits_read() / 8; | 68 const int bytes_read = reader.bits_read() / 8; |
| 69 if (sync != 0xfff || layer != 0 || frame_length < bytes_read || | 69 if (sync != 0xfff || layer != 0 || frame_length < bytes_read || |
| 70 sample_rate_index >= kADTSFrequencyTableSize || | 70 sample_rate_index >= kADTSFrequencyTableSize || |
| 71 channel_layout_index >= kADTSChannelLayoutTableSize) { | 71 channel_layout_index >= kADTSChannelLayoutTableSize) { |
| 72 MEDIA_LOG(log_cb()) << "Invalid header data :" << std::hex | 72 MEDIA_LOG(log_cb(), ERROR) << "Invalid header data :" << std::hex |
|
DaleCurtis
2015/03/31 00:12:26
Hmm are these truly errors? They won't break Appen
wolenetz
2015/03/31 00:30:11
You're right; not ERROR in all cases. I'll change
wolenetz
2015/03/31 19:20:22
Done.
| |
| 73 << " sync 0x" << sync | 73 << " sync 0x" << sync |
| 74 << " version 0x" << version | 74 << " version 0x" << version |
| 75 << " layer 0x" << layer | 75 << " layer 0x" << layer |
| 76 << " sample_rate_index 0x" << sample_rate_index | 76 << " sample_rate_index 0x" << sample_rate_index |
| 77 << " channel_layout_index 0x" << channel_layout_index; | 77 << " channel_layout_index 0x" |
| 78 << channel_layout_index; | |
| 78 return -1; | 79 return -1; |
| 79 } | 80 } |
| 80 | 81 |
| 81 if (sample_rate) | 82 if (sample_rate) |
| 82 *sample_rate = kADTSFrequencyTable[sample_rate_index]; | 83 *sample_rate = kADTSFrequencyTable[sample_rate_index]; |
| 83 | 84 |
| 84 if (frame_size) | 85 if (frame_size) |
| 85 *frame_size = frame_length; | 86 *frame_size = frame_length; |
| 86 | 87 |
| 87 if (sample_count) | 88 if (sample_count) |
| 88 *sample_count = (num_data_blocks + 1) * kSamplesPerAACFrame; | 89 *sample_count = (num_data_blocks + 1) * kSamplesPerAACFrame; |
| 89 | 90 |
| 90 if (channel_layout) | 91 if (channel_layout) |
| 91 *channel_layout = kADTSChannelLayoutTable[channel_layout_index]; | 92 *channel_layout = kADTSChannelLayoutTable[channel_layout_index]; |
| 92 | 93 |
| 93 if (metadata_frame) | 94 if (metadata_frame) |
| 94 *metadata_frame = false; | 95 *metadata_frame = false; |
| 95 | 96 |
| 96 return bytes_read; | 97 return bytes_read; |
| 97 } | 98 } |
| 98 | 99 |
| 99 } // namespace media | 100 } // namespace media |
| OLD | NEW |