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

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

Issue 11106004: Allow null buffer resources to be returned through the PPB_ContentDecryptor_Private proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/ppapi_decryptor.h" 5 #include "webkit/media/crypto/ppapi_decryptor.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 encrypted, decrypt_cb)); 98 encrypted, decrypt_cb));
99 return; 99 return;
100 } 100 }
101 101
102 DVLOG(1) << "Decrypt()"; 102 DVLOG(1) << "Decrypt()";
103 if (!cdm_plugin_->Decrypt(encrypted, decrypt_cb)) 103 if (!cdm_plugin_->Decrypt(encrypted, decrypt_cb))
104 decrypt_cb.Run(kError, NULL); 104 decrypt_cb.Run(kError, NULL);
105 } 105 }
106 106
107 void PpapiDecryptor::CancelDecrypt() { 107 void PpapiDecryptor::CancelDecrypt() {
108 DVLOG(1) << "CancelDecrypt()";
108 // TODO(xhwang): Implement CancelDecrypt() in PluginInstance and call it here. 109 // TODO(xhwang): Implement CancelDecrypt() in PluginInstance and call it here.
109 } 110 }
110 111
111 void PpapiDecryptor::InitializeVideoDecoder( 112 void PpapiDecryptor::InitializeVideoDecoder(
112 scoped_ptr<media::VideoDecoderConfig> config, 113 scoped_ptr<media::VideoDecoderConfig> config,
113 const DecoderInitCB& init_cb, 114 const DecoderInitCB& init_cb,
114 const KeyAddedCB& key_added_cb) { 115 const KeyAddedCB& key_added_cb) {
115 if (!render_loop_proxy_->BelongsToCurrentThread()) { 116 if (!render_loop_proxy_->BelongsToCurrentThread()) {
116 render_loop_proxy_->PostTask( 117 render_loop_proxy_->PostTask(
117 FROM_HERE, 118 FROM_HERE,
118 base::Bind(&PpapiDecryptor::InitializeVideoDecoder, 119 base::Bind(&PpapiDecryptor::InitializeVideoDecoder,
119 base::Unretained(this), base::Passed(&config), 120 base::Unretained(this), base::Passed(&config),
120 init_cb, key_added_cb)); 121 init_cb, key_added_cb));
121 return; 122 return;
122 } 123 }
123 124
124 DVLOG(1) << "InitializeVideoDecoder()"; 125 DVLOG(1) << "InitializeVideoDecoder()";
125 DCHECK(config->is_encrypted()); 126 DCHECK(config->is_encrypted());
126 DCHECK(config->IsValidConfig()); 127 DCHECK(config->IsValidConfig());
127 128
128 key_added_cb_ = key_added_cb;
129
130 // TODO(xhwang): Enable this once PluginInstance is updated. 129 // TODO(xhwang): Enable this once PluginInstance is updated.
131 // if (!cdm_plugin_->InitializeVideoDecoder(video_config.Pass(), init_cb)) 130 // if (!cdm_plugin_->InitializeVideoDecoder(video_config.Pass(), init_cb))
132 // init_cb.Run(false); 131 {
133 init_cb.Run(false); 132 init_cb.Run(false);
133 return;
134 }
135
136 key_added_cb_ = key_added_cb;
xhwang 2012/10/12 00:06:44 thanks!
ddorwin 2012/10/12 00:21:16 Done.
137 init_cb.Run(true);
134 } 138 }
135 139
136 void PpapiDecryptor::DecryptAndDecodeVideo( 140 void PpapiDecryptor::DecryptAndDecodeVideo(
137 const scoped_refptr<media::DecoderBuffer>& encrypted, 141 const scoped_refptr<media::DecoderBuffer>& encrypted,
138 const VideoDecodeCB& video_decode_cb) { 142 const VideoDecodeCB& video_decode_cb) {
139 if (!render_loop_proxy_->BelongsToCurrentThread()) { 143 if (!render_loop_proxy_->BelongsToCurrentThread()) {
140 render_loop_proxy_->PostTask( 144 render_loop_proxy_->PostTask(
141 FROM_HERE, 145 FROM_HERE,
142 base::Bind(&PpapiDecryptor::DecryptAndDecodeVideo, 146 base::Bind(&PpapiDecryptor::DecryptAndDecodeVideo,
143 base::Unretained(this), encrypted, video_decode_cb)); 147 base::Unretained(this), encrypted, video_decode_cb));
(...skipping 22 matching lines...) Expand all
166 NOTIMPLEMENTED(); 170 NOTIMPLEMENTED();
167 } 171 }
168 172
169 void PpapiDecryptor::ReportFailureToCallPlugin(const std::string& key_system, 173 void PpapiDecryptor::ReportFailureToCallPlugin(const std::string& key_system,
170 const std::string& session_id) { 174 const std::string& session_id) {
171 DVLOG(1) << "Failed to call plugin."; 175 DVLOG(1) << "Failed to call plugin.";
172 client_->KeyError(key_system, session_id, kUnknownError, 0); 176 client_->KeyError(key_system, session_id, kUnknownError, 0);
173 } 177 }
174 178
175 } // namespace webkit_media 179 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698