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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 base::android::ScopedJavaLocalRef<jobject> media_crypto = GetMediaCrypto(); | 590 base::android::ScopedJavaLocalRef<jobject> media_crypto = GetMediaCrypto(); |
591 if (is_video_encrypted_ && media_crypto.is_null()) | 591 if (is_video_encrypted_ && media_crypto.is_null()) |
592 return; | 592 return; |
593 | 593 |
594 DCHECK(!video_decoder_job_ || !video_decoder_job_->is_decoding()); | 594 DCHECK(!video_decoder_job_ || !video_decoder_job_->is_decoding()); |
595 | 595 |
596 // Release the old VideoDecoderJob first so the surface can get released. | 596 // Release the old VideoDecoderJob first so the surface can get released. |
597 // Android does not allow 2 MediaCodec instances use the same surface. | 597 // Android does not allow 2 MediaCodec instances use the same surface. |
598 video_decoder_job_.reset(); | 598 video_decoder_job_.reset(); |
599 // Create the new VideoDecoderJob. | 599 // Create the new VideoDecoderJob. |
600 video_decoder_job_.reset(VideoDecoderJob::Create( | 600 bool is_secure = IsProtectedSurfaceRequired(); |
601 video_codec_, gfx::Size(width_, height_), surface_.j_surface().obj(), | 601 video_decoder_job_.reset( |
602 media_crypto.obj(), | 602 VideoDecoderJob::Create(video_codec_, |
603 base::Bind(&MediaPlayerManager::OnReadFromDemuxer, | 603 is_secure, |
604 base::Unretained(manager()), | 604 gfx::Size(width_, height_), |
605 player_id(), | 605 surface_.j_surface().obj(), |
606 DemuxerStream::VIDEO))); | 606 media_crypto.obj(), |
| 607 base::Bind(&MediaPlayerManager::OnReadFromDemuxer, |
| 608 base::Unretained(manager()), |
| 609 player_id(), |
| 610 DemuxerStream::VIDEO))); |
607 if (video_decoder_job_) | 611 if (video_decoder_job_) |
608 reconfig_video_decoder_ = false; | 612 reconfig_video_decoder_ = false; |
609 | 613 |
610 // Inform the fullscreen view the player is ready. | 614 // Inform the fullscreen view the player is ready. |
611 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way | 615 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way |
612 // to inform ContentVideoView. | 616 // to inform ContentVideoView. |
613 OnMediaMetadataChanged(duration_, width_, height_, true); | 617 OnMediaMetadataChanged(duration_, width_, height_, true); |
614 } | 618 } |
615 | 619 |
616 void MediaSourcePlayer::OnDecoderStarved() { | 620 void MediaSourcePlayer::OnDecoderStarved() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 700 |
697 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { | 701 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { |
698 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; | 702 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; |
699 DCHECK_NE(event, NO_EVENT_PENDING); | 703 DCHECK_NE(event, NO_EVENT_PENDING); |
700 DCHECK(IsEventPending(event)); | 704 DCHECK(IsEventPending(event)); |
701 | 705 |
702 pending_event_ &= ~event; | 706 pending_event_ &= ~event; |
703 } | 707 } |
704 | 708 |
705 } // namespace media | 709 } // namespace media |
OLD | NEW |