Chromium Code Reviews| 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 "webkit/media/crypto/ppapi/clear_key_cdm.h" | 5 #include "webkit/media/crypto/ppapi/clear_key_cdm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 init_data, init_data_size); | 228 init_data, init_data_size); |
| 229 | 229 |
| 230 if (client_.status() != Client::kKeyMessage) | 230 if (client_.status() != Client::kKeyMessage) |
| 231 return cdm::kSessionError; | 231 return cdm::kSessionError; |
| 232 | 232 |
| 233 DCHECK(key_request); | 233 DCHECK(key_request); |
| 234 key_request->set_session_id(client_.session_id().data(), | 234 key_request->set_session_id(client_.session_id().data(), |
| 235 client_.session_id().size()); | 235 client_.session_id().size()); |
| 236 latest_session_id_ = client_.session_id(); | 236 latest_session_id_ = client_.session_id(); |
| 237 | 237 |
| 238 // TODO(tomfinegan): Get rid of this copy. | 238 if (client_.key_message_length()) { |
| 239 key_request->set_message(allocator_->Allocate(client_.key_message_length())); | 239 // TODO(tomfinegan): Get rid of this copy. |
| 240 DCHECK(key_request->message()); | 240 key_request->set_message( |
| 241 DCHECK_EQ(key_request->message()->size(), client_.key_message_length()); | 241 allocator_->Allocate(client_.key_message_length())); |
| 242 memcpy(key_request->message()->data(), | 242 DCHECK(key_request->message()); |
| 243 client_.key_message(), client_.key_message_length()); | 243 DCHECK_EQ(key_request->message()->size(), client_.key_message_length()); |
| 244 memcpy(key_request->message()->data(), | |
| 245 client_.key_message(), client_.key_message_length()); | |
| 246 } else { | |
| 247 key_request->set_message(NULL); | |
|
ddorwin
2012/12/04 01:44:10
Is this not the default?
xhwang
2012/12/04 01:58:51
You are right. Added DCHECK and removed "else".
| |
| 248 } | |
| 244 | 249 |
| 245 key_request->set_default_url(client_.default_url().data(), | 250 key_request->set_default_url(client_.default_url().data(), |
| 246 client_.default_url().size()); | 251 client_.default_url().size()); |
| 247 | 252 |
| 248 return cdm::kSuccess; | 253 return cdm::kSuccess; |
| 249 } | 254 } |
| 250 | 255 |
| 251 cdm::Status ClearKeyCdm::AddKey(const char* session_id, | 256 cdm::Status ClearKeyCdm::AddKey(const char* session_id, |
| 252 int session_id_size, | 257 int session_id_size, |
| 253 const uint8_t* key, | 258 const uint8_t* key, |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 | 604 |
| 600 static unsigned char color = 0; | 605 static unsigned char color = 0; |
| 601 color += 10; | 606 color += 10; |
| 602 | 607 |
| 603 memset(reinterpret_cast<void*>(video_frame->frame_buffer()->data()), | 608 memset(reinterpret_cast<void*>(video_frame->frame_buffer()->data()), |
| 604 color, frame_size); | 609 color, frame_size); |
| 605 } | 610 } |
| 606 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 611 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 607 | 612 |
| 608 } // namespace webkit_media | 613 } // namespace webkit_media |
| OLD | NEW |