OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/mojo/clients/mojo_cdm.h" | 5 #include "media/mojo/clients/mojo_cdm.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 int MojoCdm::GetCdmId() const { | 235 int MojoCdm::GetCdmId() const { |
236 base::AutoLock auto_lock(lock_); | 236 base::AutoLock auto_lock(lock_); |
237 // Can be called on a different thread. | 237 // Can be called on a different thread. |
238 DCHECK_NE(CdmContext::kInvalidCdmId, cdm_id_); | 238 DCHECK_NE(CdmContext::kInvalidCdmId, cdm_id_); |
239 return cdm_id_; | 239 return cdm_id_; |
240 } | 240 } |
241 | 241 |
242 void MojoCdm::OnSessionMessage(const mojo::String& session_id, | 242 void MojoCdm::OnSessionMessage(const mojo::String& session_id, |
243 mojom::CdmMessageType message_type, | 243 mojom::CdmMessageType message_type, |
244 mojo::Array<uint8_t> message, | 244 mojo::Array<uint8_t> message, |
245 const mojo::String& legacy_destination_url) { | 245 const GURL& legacy_destination_url) { |
246 DVLOG(2) << __FUNCTION__; | 246 DVLOG(2) << __FUNCTION__; |
247 DCHECK(thread_checker_.CalledOnValidThread()); | 247 DCHECK(thread_checker_.CalledOnValidThread()); |
248 | 248 |
249 GURL verified_gurl = GURL(legacy_destination_url.get()); | |
250 if (!verified_gurl.is_valid() && !verified_gurl.is_empty()) { | |
251 DLOG(WARNING) << "SessionMessage destination_url is invalid : " | |
252 << verified_gurl.possibly_invalid_spec(); | |
253 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. | |
254 } | |
255 | |
256 session_message_cb_.Run(session_id, | 249 session_message_cb_.Run(session_id, |
257 static_cast<MediaKeys::MessageType>(message_type), | 250 static_cast<MediaKeys::MessageType>(message_type), |
258 message.storage(), verified_gurl); | 251 message.storage(), legacy_destination_url); |
259 } | 252 } |
260 | 253 |
261 void MojoCdm::OnSessionClosed(const mojo::String& session_id) { | 254 void MojoCdm::OnSessionClosed(const mojo::String& session_id) { |
262 DVLOG(2) << __FUNCTION__; | 255 DVLOG(2) << __FUNCTION__; |
263 DCHECK(thread_checker_.CalledOnValidThread()); | 256 DCHECK(thread_checker_.CalledOnValidThread()); |
264 | 257 |
265 session_closed_cb_.Run(session_id); | 258 session_closed_cb_.Run(session_id); |
266 } | 259 } |
267 | 260 |
268 void MojoCdm::OnLegacySessionError(const mojo::String& session_id, | 261 void MojoCdm::OnLegacySessionError(const mojo::String& session_id, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 base::AutoLock auto_lock(lock_); | 335 base::AutoLock auto_lock(lock_); |
343 | 336 |
344 DCHECK(decryptor_task_runner_); | 337 DCHECK(decryptor_task_runner_); |
345 DCHECK(decryptor_task_runner_->BelongsToCurrentThread()); | 338 DCHECK(decryptor_task_runner_->BelongsToCurrentThread()); |
346 DCHECK(decryptor_); | 339 DCHECK(decryptor_); |
347 | 340 |
348 decryptor_->OnKeyAdded(); | 341 decryptor_->OnKeyAdded(); |
349 } | 342 } |
350 | 343 |
351 } // namespace media | 344 } // namespace media |
OLD | NEW |