| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 << " version 0x" << version | 67 << " version 0x" << version |
| 68 << " layer 0x" << layer | 68 << " layer 0x" << layer |
| 69 << " profile 0x" << profile | 69 << " profile 0x" << profile |
| 70 << " sample_rate_index 0x" << sample_rate_index | 70 << " sample_rate_index 0x" << sample_rate_index |
| 71 << " channel_layout_index 0x" << channel_layout_index; | 71 << " channel_layout_index 0x" << channel_layout_index; |
| 72 | 72 |
| 73 const int bytes_read = reader.bits_read() / 8; | 73 const int bytes_read = reader.bits_read() / 8; |
| 74 if (sync != 0xfff || layer != 0 || frame_length < bytes_read || | 74 if (sync != 0xfff || layer != 0 || frame_length < bytes_read || |
| 75 sample_rate_index >= kADTSFrequencyTableSize || | 75 sample_rate_index >= kADTSFrequencyTableSize || |
| 76 channel_layout_index >= kADTSChannelLayoutTableSize) { | 76 channel_layout_index >= kADTSChannelLayoutTableSize) { |
| 77 MEDIA_LOG(DEBUG, media_log()) | 77 if (media_log()) { |
| 78 << "Invalid header data :" << std::hex << " sync 0x" << sync | 78 MEDIA_LOG(DEBUG, media_log()) |
| 79 << " version 0x" << version << " layer 0x" << layer | 79 << "Invalid header data :" << std::hex << " sync 0x" << sync |
| 80 << " sample_rate_index 0x" << sample_rate_index | 80 << " version 0x" << version << " layer 0x" << layer |
| 81 << " channel_layout_index 0x" << channel_layout_index; | 81 << " sample_rate_index 0x" << sample_rate_index |
| 82 << " channel_layout_index 0x" << channel_layout_index; |
| 83 } |
| 82 return -1; | 84 return -1; |
| 83 } | 85 } |
| 84 | 86 |
| 85 if (sample_rate) | 87 if (sample_rate) |
| 86 *sample_rate = kADTSFrequencyTable[sample_rate_index]; | 88 *sample_rate = kADTSFrequencyTable[sample_rate_index]; |
| 87 | 89 |
| 88 if (frame_size) | 90 if (frame_size) |
| 89 *frame_size = frame_length; | 91 *frame_size = frame_length; |
| 90 | 92 |
| 91 if (sample_count) | 93 if (sample_count) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 extra_data->push_back(esds >> 8); | 113 extra_data->push_back(esds >> 8); |
| 112 extra_data->push_back(esds & 0xFF); | 114 extra_data->push_back(esds & 0xFF); |
| 113 if (media_log()) | 115 if (media_log()) |
| 114 DCHECK(mp4::AAC().Parse(*extra_data, media_log())); | 116 DCHECK(mp4::AAC().Parse(*extra_data, media_log())); |
| 115 } | 117 } |
| 116 | 118 |
| 117 return bytes_read; | 119 return bytes_read; |
| 118 } | 120 } |
| 119 | 121 |
| 120 } // namespace media | 122 } // namespace media |
| OLD | NEW |