| 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(DEBUG, log_cb()) | 72 MEDIA_LOG(DEBUG, media_log()) |
| 73 << "Invalid header data :" << std::hex << " sync 0x" << sync | 73 << "Invalid header data :" << std::hex << " sync 0x" << sync |
| 74 << " version 0x" << version << " layer 0x" << layer | 74 << " version 0x" << version << " layer 0x" << layer |
| 75 << " sample_rate_index 0x" << sample_rate_index | 75 << " sample_rate_index 0x" << sample_rate_index |
| 76 << " channel_layout_index 0x" << channel_layout_index; | 76 << " channel_layout_index 0x" << channel_layout_index; |
| 77 return -1; | 77 return -1; |
| 78 } | 78 } |
| 79 | 79 |
| 80 if (sample_rate) | 80 if (sample_rate) |
| 81 *sample_rate = kADTSFrequencyTable[sample_rate_index]; | 81 *sample_rate = kADTSFrequencyTable[sample_rate_index]; |
| 82 | 82 |
| 83 if (frame_size) | 83 if (frame_size) |
| 84 *frame_size = frame_length; | 84 *frame_size = frame_length; |
| 85 | 85 |
| 86 if (sample_count) | 86 if (sample_count) |
| 87 *sample_count = (num_data_blocks + 1) * kSamplesPerAACFrame; | 87 *sample_count = (num_data_blocks + 1) * kSamplesPerAACFrame; |
| 88 | 88 |
| 89 if (channel_layout) | 89 if (channel_layout) |
| 90 *channel_layout = kADTSChannelLayoutTable[channel_layout_index]; | 90 *channel_layout = kADTSChannelLayoutTable[channel_layout_index]; |
| 91 | 91 |
| 92 if (metadata_frame) | 92 if (metadata_frame) |
| 93 *metadata_frame = false; | 93 *metadata_frame = false; |
| 94 | 94 |
| 95 return bytes_read; | 95 return bytes_read; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace media | 98 } // namespace media |
| OLD | NEW |