OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/crypto/ppapi_decryptor.h" | 5 #include "content/renderer/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/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 DVLOG(2) << __FUNCTION__; | 136 DVLOG(2) << __FUNCTION__; |
137 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 137 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
138 | 138 |
139 if (!plugin_cdm_delegate_ || | 139 if (!plugin_cdm_delegate_ || |
140 !plugin_cdm_delegate_->ReleaseSession(session_id)) { | 140 !plugin_cdm_delegate_->ReleaseSession(session_id)) { |
141 ReportFailureToCallPlugin(session_id); | 141 ReportFailureToCallPlugin(session_id); |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 media::Decryptor* PpapiDecryptor::GetDecryptor() { | 145 media::Decryptor* PpapiDecryptor::GetDecryptor() { |
146 #if defined(GOOGLE_TV) | |
147 // Google TV only uses PpapiDecrytor as a MediaKeys and does not need the | |
148 // Decryptor interface of the PpapiDecryptor. | |
149 // Details: If we don't do this GTV will be broken. The reason is that during | |
150 // initialization, MediaSourceDelegate tries to use DecryptingDemuxerStream | |
151 // to decrypt the stream in the renderer process (for ClearKey support). | |
152 // However, for GTV, PpapiDecryptor cannot do decryption at all. By returning | |
153 // NULL, DDS init will fail and we fallback to what GTV used to do. | |
154 return NULL; | |
155 #else | |
156 return this; | 146 return this; |
157 #endif // defined(GOOGLE_TV) | |
158 } | 147 } |
159 | 148 |
160 void PpapiDecryptor::RegisterNewKeyCB(StreamType stream_type, | 149 void PpapiDecryptor::RegisterNewKeyCB(StreamType stream_type, |
161 const NewKeyCB& new_key_cb) { | 150 const NewKeyCB& new_key_cb) { |
162 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 151 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
163 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 152 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
164 &PpapiDecryptor::RegisterNewKeyCB, weak_this_, stream_type, | 153 &PpapiDecryptor::RegisterNewKeyCB, weak_this_, stream_type, |
165 new_key_cb)); | 154 new_key_cb)); |
166 return; | 155 return; |
167 } | 156 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 355 |
367 void PpapiDecryptor::OnFatalPluginError() { | 356 void PpapiDecryptor::OnFatalPluginError() { |
368 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 357 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
369 DCHECK(plugin_cdm_delegate_); | 358 DCHECK(plugin_cdm_delegate_); |
370 plugin_cdm_delegate_ = NULL; | 359 plugin_cdm_delegate_ = NULL; |
371 plugin_instance_ = NULL; | 360 plugin_instance_ = NULL; |
372 base::ResetAndReturn(&destroy_plugin_cb_).Run(); | 361 base::ResetAndReturn(&destroy_plugin_cb_).Run(); |
373 } | 362 } |
374 | 363 |
375 } // namespace content | 364 } // namespace content |
OLD | NEW |