Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: webkit/media/crypto/ppapi/clear_key_cdm.cc

Issue 11348365: Encrypted Media: Allows empty key message to be fired. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update doc Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 DCHECK(!key_request->message());
239 key_request->set_message(allocator_->Allocate(client_.key_message_length())); 239 if (client_.key_message_length()) {
240 DCHECK(key_request->message()); 240 // TODO(tomfinegan): Get rid of this copy.
241 DCHECK_EQ(key_request->message()->size(), client_.key_message_length()); 241 key_request->set_message(
242 memcpy(key_request->message()->data(), 242 allocator_->Allocate(client_.key_message_length()));
243 client_.key_message(), client_.key_message_length()); 243 DCHECK(key_request->message());
244 DCHECK_EQ(key_request->message()->size(), client_.key_message_length());
245 memcpy(key_request->message()->data(),
246 client_.key_message(), client_.key_message_length());
247 }
244 248
245 key_request->set_default_url(client_.default_url().data(), 249 key_request->set_default_url(client_.default_url().data(),
246 client_.default_url().size()); 250 client_.default_url().size());
247 251
248 return cdm::kSuccess; 252 return cdm::kSuccess;
249 } 253 }
250 254
251 cdm::Status ClearKeyCdm::AddKey(const char* session_id, 255 cdm::Status ClearKeyCdm::AddKey(const char* session_id,
252 int session_id_size, 256 int session_id_size,
253 const uint8_t* key, 257 const uint8_t* key,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 603
600 static unsigned char color = 0; 604 static unsigned char color = 0;
601 color += 10; 605 color += 10;
602 606
603 memset(reinterpret_cast<void*>(video_frame->frame_buffer()->data()), 607 memset(reinterpret_cast<void*>(video_frame->frame_buffer()->data()),
604 color, frame_size); 608 color, frame_size);
605 } 609 }
606 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER 610 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER
607 611
608 } // namespace webkit_media 612 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/crypto/ppapi/cdm_wrapper.cc ('k') | webkit/plugins/ppapi/content_decryptor_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698