Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/media/cdm/chromecast_init_data.h" | 5 #include "chromecast/media/cdm/chromecast_init_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/bit_reader.h" | 8 #include "media/base/bit_reader.h" |
| 9 | 9 |
| 10 namespace chromecast { | 10 namespace chromecast { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 ::media::BitReader systemIdReader(&init_data[reader.bits_read() / 8], | 101 ::media::BitReader systemIdReader(&init_data[reader.bits_read() / 8], |
| 102 box_size - box_bytes_read); | 102 box_size - box_bytes_read); |
| 103 if (!IsChromecastSystemId(systemIdReader)) { | 103 if (!IsChromecastSystemId(systemIdReader)) { |
| 104 reader.SkipBits((box_size - box_bytes_read) * 8); | 104 reader.SkipBits((box_size - box_bytes_read) * 8); |
| 105 continue; | 105 continue; |
| 106 } | 106 } |
| 107 RCHECK(reader.SkipBits(16 * 8)); | 107 RCHECK(reader.SkipBits(16 * 8)); |
| 108 box_bytes_read += 16; | 108 box_bytes_read += 16; |
| 109 | 109 |
| 110 uint32_t data_size; | |
| 111 RCHECK(reader.ReadBits(4 * 8, &data_size)); | |
| 112 box_bytes_read += 4; | |
| 113 RCHECK(data_size == box_size - box_bytes_read); | |
|
lcwu1
2015/06/09 18:22:22
Are we adding a new data_size field in the custom
gunsch
2015/06/09 18:54:13
We are not, and even if we were this does not affe
| |
| 114 | |
| 110 uint16_t msg_type; | 115 uint16_t msg_type; |
| 111 RCHECK(reader.ReadBits(2 * 8, &msg_type)); | 116 RCHECK(reader.ReadBits(2 * 8, &msg_type)); |
| 112 box_bytes_read += 2; | 117 box_bytes_read += 2; |
| 113 RCHECK(msg_type < static_cast<uint16_t>(InitDataMessageType::END)); | 118 RCHECK(msg_type < static_cast<uint16_t>(InitDataMessageType::END)); |
| 114 | 119 |
| 115 chromecast_init_data_out->type = static_cast<InitDataMessageType>(msg_type); | 120 chromecast_init_data_out->type = static_cast<InitDataMessageType>(msg_type); |
| 116 const uint8_t* data_start = &init_data[0] + reader.bits_read() / 8; | 121 const uint8_t* data_start = &init_data[0] + reader.bits_read() / 8; |
| 117 chromecast_init_data_out->data.assign( | 122 chromecast_init_data_out->data.assign( |
| 118 data_start, data_start + box_size - box_bytes_read); | 123 data_start, data_start + box_size - box_bytes_read); |
| 119 return true; | 124 return true; |
| 120 } | 125 } |
| 121 return false; | 126 return false; |
| 122 } | 127 } |
| 123 | 128 |
| 124 } // namespace media | 129 } // namespace media |
| 125 } // namespace chromecast | 130 } // namespace chromecast |
| OLD | NEW |