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