Chromium Code Reviews| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 sampling_rate_(0), | 279 sampling_rate_(0), |
| 280 audio_finished_(true), | 280 audio_finished_(true), |
| 281 video_finished_(true), | 281 video_finished_(true), |
| 282 playing_(false), | 282 playing_(false), |
| 283 reconfig_audio_decoder_(false), | 283 reconfig_audio_decoder_(false), |
| 284 reconfig_video_decoder_(false), | 284 reconfig_video_decoder_(false), |
| 285 audio_access_unit_index_(0), | 285 audio_access_unit_index_(0), |
| 286 video_access_unit_index_(0), | 286 video_access_unit_index_(0), |
| 287 waiting_for_audio_data_(false), | 287 waiting_for_audio_data_(false), |
| 288 waiting_for_video_data_(false), | 288 waiting_for_video_data_(false), |
| 289 weak_this_(this) { | 289 weak_this_(this), |
| 290 drm_bridge_(NULL) { | |
| 290 } | 291 } |
| 291 | 292 |
| 292 MediaSourcePlayer::~MediaSourcePlayer() { | 293 MediaSourcePlayer::~MediaSourcePlayer() { |
| 293 Release(); | 294 Release(); |
| 294 } | 295 } |
| 295 | 296 |
| 296 void MediaSourcePlayer::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 297 void MediaSourcePlayer::SetVideoSurface(gfx::ScopedJavaSurface surface) { |
| 297 surface_ = surface.Pass(); | 298 surface_ = surface.Pass(); |
| 298 pending_event_ |= SURFACE_CHANGE_EVENT_PENDING; | 299 pending_event_ |= SURFACE_CHANGE_EVENT_PENDING; |
| 299 if (pending_event_ & SEEK_EVENT_PENDING) { | 300 if (pending_event_ & SEEK_EVENT_PENDING) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 received_video_ = params; | 465 received_video_ = params; |
| 465 if (!pending_event_) | 466 if (!pending_event_) |
| 466 DecodeMoreVideo(); | 467 DecodeMoreVideo(); |
| 467 } | 468 } |
| 468 } | 469 } |
| 469 | 470 |
| 470 void MediaSourcePlayer::DurationChanged(const base::TimeDelta& duration) { | 471 void MediaSourcePlayer::DurationChanged(const base::TimeDelta& duration) { |
| 471 duration_ = duration; | 472 duration_ = duration; |
| 472 } | 473 } |
| 473 | 474 |
| 475 void MediaSourcePlayer::SetDrmBridge(MediaDrmBridge* drm_bridge) { | |
| 476 drm_bridge_ = drm_bridge; | |
| 477 // TODO(qinmin): similar to SetVideoSurface() call, we need to wait for the | |
| 478 // current decoder jobs to finish, and then use the ProcessPendingEvents() | |
| 479 // to pass the drm_bridge to the decoder jobs. | |
|
xhwang
2013/06/21 20:45:11
I am not sure if we could/should do here. So this
qinmin
2013/06/21 20:53:17
This is just to handle a DRM change in the middle
| |
| 480 } | |
| 481 | |
| 474 void MediaSourcePlayer::OnSeekRequestAck(unsigned seek_request_id) { | 482 void MediaSourcePlayer::OnSeekRequestAck(unsigned seek_request_id) { |
| 475 // Do nothing until the most recent seek request is processed. | 483 // Do nothing until the most recent seek request is processed. |
| 476 if (seek_request_id_ != seek_request_id) | 484 if (seek_request_id_ != seek_request_id) |
| 477 return; | 485 return; |
| 478 pending_event_ &= ~SEEK_EVENT_PENDING; | 486 pending_event_ &= ~SEEK_EVENT_PENDING; |
| 479 OnSeekComplete(); | 487 OnSeekComplete(); |
| 480 ProcessPendingEvents(); | 488 ProcessPendingEvents(); |
| 481 } | 489 } |
| 482 | 490 |
| 483 void MediaSourcePlayer::UpdateTimestamps( | 491 void MediaSourcePlayer::UpdateTimestamps( |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 reconfig_video_decoder_ = false; | 698 reconfig_video_decoder_ = false; |
| 691 } | 699 } |
| 692 | 700 |
| 693 // Inform the fullscreen view the player is ready. | 701 // Inform the fullscreen view the player is ready. |
| 694 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way | 702 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way |
| 695 // to inform ContentVideoView. | 703 // to inform ContentVideoView. |
| 696 OnMediaMetadataChanged(duration_, width_, height_, true); | 704 OnMediaMetadataChanged(duration_, width_, height_, true); |
| 697 } | 705 } |
| 698 | 706 |
| 699 } // namespace media | 707 } // namespace media |
| OLD | NEW |