| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "media/base/android/media_source_player.h" | 5 #include "media/base/android/media_source_player.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 367 } |
| 368 | 368 |
| 369 void MediaSourcePlayer::OnMediaCryptoReady() { | 369 void MediaSourcePlayer::OnMediaCryptoReady() { |
| 370 DCHECK(!drm_bridge_->GetMediaCrypto().is_null()); | 370 DCHECK(!drm_bridge_->GetMediaCrypto().is_null()); |
| 371 drm_bridge_->SetMediaCryptoReadyCB(base::Closure()); | 371 drm_bridge_->SetMediaCryptoReadyCB(base::Closure()); |
| 372 | 372 |
| 373 if (playing_) | 373 if (playing_) |
| 374 StartInternal(); | 374 StartInternal(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void MediaSourcePlayer::SetDrmBridge(MediaDrmBridge* drm_bridge) { | 377 void MediaSourcePlayer::SetCdm(MediaKeys* cdm) { |
| 378 // Currently we don't support DRM change during the middle of playback, even | 378 // Currently we don't support DRM change during the middle of playback, even |
| 379 // if the player is paused. | 379 // if the player is paused. |
| 380 // TODO(qinmin): support DRM change after playback has started. | 380 // TODO(qinmin): support DRM change after playback has started. |
| 381 // http://crbug.com/253792. | 381 // http://crbug.com/253792. |
| 382 if (GetCurrentTime() > base::TimeDelta()) { | 382 if (GetCurrentTime() > base::TimeDelta()) { |
| 383 VLOG(0) << "Setting DRM bridge after playback has started. " | 383 VLOG(0) << "Setting DRM bridge after playback has started. " |
| 384 << "This is not well supported!"; | 384 << "This is not well supported!"; |
| 385 } | 385 } |
| 386 | 386 |
| 387 drm_bridge_ = drm_bridge; | 387 // Only MediaDrmBridge will be set on MediaSourcePlayer. |
| 388 drm_bridge_ = static_cast<MediaDrmBridge*>(cdm); |
| 388 | 389 |
| 389 if (drm_bridge_->GetMediaCrypto().is_null()) { | 390 if (drm_bridge_->GetMediaCrypto().is_null()) { |
| 390 drm_bridge_->SetMediaCryptoReadyCB(base::Bind( | 391 drm_bridge_->SetMediaCryptoReadyCB(base::Bind( |
| 391 &MediaSourcePlayer::OnMediaCryptoReady, weak_factory_.GetWeakPtr())); | 392 &MediaSourcePlayer::OnMediaCryptoReady, weak_factory_.GetWeakPtr())); |
| 392 return; | 393 return; |
| 393 } | 394 } |
| 394 | 395 |
| 395 if (playing_) | 396 if (playing_) |
| 396 StartInternal(); | 397 StartInternal(); |
| 397 } | 398 } |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 | 1009 |
| 1009 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { | 1010 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { |
| 1010 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; | 1011 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; |
| 1011 DCHECK_NE(event, NO_EVENT_PENDING); | 1012 DCHECK_NE(event, NO_EVENT_PENDING); |
| 1012 DCHECK(IsEventPending(event)) << GetEventName(event); | 1013 DCHECK(IsEventPending(event)) << GetEventName(event); |
| 1013 | 1014 |
| 1014 pending_event_ &= ~event; | 1015 pending_event_ &= ~event; |
| 1015 } | 1016 } |
| 1016 | 1017 |
| 1017 } // namespace media | 1018 } // namespace media |
| OLD | NEW |