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

Side by Side Diff: webkit/media/crypto/proxy_decryptor.cc

Issue 10969028: Add video decoding methods in Decryptor and add DecryptingVideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unitttests and resolved comments. Created 8 years, 2 months 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/proxy_decryptor.h" 5 #include "webkit/media/crypto/proxy_decryptor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
14 #include "media/base/decryptor_client.h" 14 #include "media/base/decryptor_client.h"
15 #include "media/base/video_decoder_config.h"
16 #include "media/base/video_frame.h"
ddorwin 2012/09/26 02:34:27 What is used from this?
15 #include "media/crypto/aes_decryptor.h" 17 #include "media/crypto/aes_decryptor.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
18 #include "webkit/media/crypto/key_systems.h" 20 #include "webkit/media/crypto/key_systems.h"
19 #include "webkit/media/crypto/ppapi_decryptor.h" 21 #include "webkit/media/crypto/ppapi_decryptor.h"
20 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 22 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
21 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 23 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
22 // TODO(xhwang): Put this include after "ppapi_plugin_instance.h" for definition 24 // TODO(xhwang): Put this include after "ppapi_plugin_instance.h" for definition
23 // of "uint8_t", which WebMediaPlayer.h uses without including a header for it. 25 // of "uint8_t", which WebMediaPlayer.h uses without including a header for it.
24 // See: https://bugs.webkit.org/show_bug.cgi?id=92031 26 // See: https://bugs.webkit.org/show_bug.cgi?id=92031
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 std::swap(pending_decrypt_closures_, closures_to_run); 180 std::swap(pending_decrypt_closures_, closures_to_run);
179 } 181 }
180 182
181 for (std::vector<base::Closure>::iterator iter = closures_to_run.begin(); 183 for (std::vector<base::Closure>::iterator iter = closures_to_run.begin();
182 iter != closures_to_run.end(); 184 iter != closures_to_run.end();
183 ++iter) { 185 ++iter) {
184 iter->Run(); 186 iter->Run();
185 } 187 }
186 } 188 }
187 189
190 void ProxyDecryptor::InitializeVideoDecoder(
191 const media::VideoDecoderConfig& config,
192 const DecoderInitCB& init_cb) {
193 // TODO(xhwang): Implement this!
194 NOTIMPLEMENTED();
195 init_cb.Run(false);
196 }
197
198 void ProxyDecryptor::DecryptAndDecodeVideo(
199 const scoped_refptr<media::DecoderBuffer>& encrypted,
200 const VideoDecodeCB& video_decode_cb) {
201 // TODO(xhwang): Implement this!
202 NOTIMPLEMENTED();
203 video_decode_cb.Run(kError, NULL);
204 }
205
206 void ProxyDecryptor::CancelDecryptAndDecodeVideo() {
207 // TODO(xhwang): Implement this!
208 NOTIMPLEMENTED();
209 }
210
211 void ProxyDecryptor::StopVideoDecoder() {
212 // TODO(xhwang): Implement this!
213 NOTIMPLEMENTED();
214 }
215
188 scoped_ptr<media::Decryptor> ProxyDecryptor::CreatePpapiDecryptor( 216 scoped_ptr<media::Decryptor> ProxyDecryptor::CreatePpapiDecryptor(
189 const std::string& key_system) { 217 const std::string& key_system) {
190 DCHECK(client_); 218 DCHECK(client_);
191 DCHECK(web_media_player_client_); 219 DCHECK(web_media_player_client_);
192 DCHECK(web_frame_); 220 DCHECK(web_frame_);
193 221
194 std::string plugin_type = GetPluginType(key_system); 222 std::string plugin_type = GetPluginType(key_system);
195 DCHECK(!plugin_type.empty()); 223 DCHECK(!plugin_type.empty());
196 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance = 224 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance =
197 CreatePluginInstance(plugin_type, web_media_player_client_, web_frame_); 225 CreatePluginInstance(plugin_type, web_media_player_client_, web_frame_);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 &ProxyDecryptor::DecryptOnMessageLoop, base::Unretained(this), 297 &ProxyDecryptor::DecryptOnMessageLoop, base::Unretained(this),
270 message_loop_proxy, encrypted, decrypt_cb)); 298 message_loop_proxy, encrypted, decrypt_cb));
271 } 299 }
272 // TODO(xhwang): The same NeedKey may be fired multiple times here and also 300 // TODO(xhwang): The same NeedKey may be fired multiple times here and also
273 // in Decrypt(). While the spec says only one NeedKey should be fired. Leave 301 // in Decrypt(). While the spec says only one NeedKey should be fired. Leave
274 // them as is since the spec about this may change. 302 // them as is since the spec about this may change.
275 FireNeedKey(client_, encrypted); 303 FireNeedKey(client_, encrypted);
276 } 304 }
277 305
278 } // namespace webkit_media 306 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698