OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webm/webm_content_encodings_client.h" | 5 #include "media/webm/webm_content_encodings_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "media/webm/webm_constants.h" | 9 #include "media/webm/webm_constants.h" |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 // Multiple occurrence restriction is checked in this function. Mandatory | 243 // Multiple occurrence restriction is checked in this function. Mandatory |
244 // restriction is checked in OnListEnd. | 244 // restriction is checked in OnListEnd. |
245 bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) { | 245 bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) { |
246 DCHECK(cur_content_encoding_.get()); | 246 DCHECK(cur_content_encoding_.get()); |
247 DCHECK(data); | 247 DCHECK(data); |
248 DCHECK_GT(size, 0); | 248 DCHECK_GT(size, 0); |
249 | 249 |
250 if (id == kWebMIdContentEncKeyID) { | 250 if (id == kWebMIdContentEncKeyID) { |
251 if (cur_content_encoding_->encryption_key_id() || | 251 if (!cur_content_encoding_->encryption_key_id().empty()) { |
252 cur_content_encoding_->encryption_key_id_size()) { | |
253 DVLOG(1) << "Unexpected multiple ContentEncKeyID"; | 252 DVLOG(1) << "Unexpected multiple ContentEncKeyID"; |
254 return false; | 253 return false; |
255 } | 254 } |
256 cur_content_encoding_->SetEncryptionKeyId(data, size); | 255 cur_content_encoding_->SetEncryptionKeyId(data, size); |
257 return true; | 256 return true; |
258 } | 257 } |
259 | 258 |
260 // This should not happen if WebMListParser is working properly. | 259 // This should not happen if WebMListParser is working properly. |
261 DCHECK(false); | 260 DCHECK(false); |
262 return false; | 261 return false; |
263 } | 262 } |
264 | 263 |
265 } // namespace media | 264 } // namespace media |
OLD | NEW |