Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: media/base/android/media_source_player.cc

Issue 23480036: Support creating secure decoder in MediaCodecBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/barrier_closure.h" 9 #include "base/barrier_closure.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 base::android::ScopedJavaLocalRef<jobject> media_crypto = GetMediaCrypto(); 577 base::android::ScopedJavaLocalRef<jobject> media_crypto = GetMediaCrypto();
578 if (is_video_encrypted_ && media_crypto.is_null()) 578 if (is_video_encrypted_ && media_crypto.is_null())
579 return; 579 return;
580 580
581 DCHECK(!video_decoder_job_ || !video_decoder_job_->is_decoding()); 581 DCHECK(!video_decoder_job_ || !video_decoder_job_->is_decoding());
582 582
583 // Release the old VideoDecoderJob first so the surface can get released. 583 // Release the old VideoDecoderJob first so the surface can get released.
584 // Android does not allow 2 MediaCodec instances use the same surface. 584 // Android does not allow 2 MediaCodec instances use the same surface.
585 video_decoder_job_.reset(); 585 video_decoder_job_.reset();
586 // Create the new VideoDecoderJob. 586 // Create the new VideoDecoderJob.
587 video_decoder_job_.reset(VideoDecoderJob::Create( 587 bool is_secure = drm_bridge_->IsProtectedSurfaceRequired();
qinmin 2013/09/05 22:15:31 you need to null check drm_bridge_ here.
xhwang 2013/09/06 02:17:47 Use IsProtectedSurfaceRequired() here which checks
588 video_codec_, gfx::Size(width_, height_), surface_.j_surface().obj(), 588 video_decoder_job_.reset(
589 media_crypto.obj(), 589 VideoDecoderJob::Create(video_codec_,
590 base::Bind(&MediaPlayerManager::OnReadFromDemuxer, 590 is_secure,
591 base::Unretained(manager()), 591 gfx::Size(width_, height_),
592 player_id(), 592 surface_.j_surface().obj(),
593 DemuxerStream::VIDEO))); 593 media_crypto.obj(),
594 base::Bind(&MediaPlayerManager::OnReadFromDemuxer,
595 base::Unretained(manager()),
596 player_id(),
597 DemuxerStream::VIDEO)));
594 if (video_decoder_job_) 598 if (video_decoder_job_)
595 reconfig_video_decoder_ = false; 599 reconfig_video_decoder_ = false;
596 600
597 // Inform the fullscreen view the player is ready. 601 // Inform the fullscreen view the player is ready.
598 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way 602 // TODO(qinmin): refactor MediaPlayerBridge so that we have a better way
599 // to inform ContentVideoView. 603 // to inform ContentVideoView.
600 OnMediaMetadataChanged(duration_, width_, height_, true); 604 OnMediaMetadataChanged(duration_, width_, height_, true);
601 } 605 }
602 606
603 void MediaSourcePlayer::OnDecoderStarved() { 607 void MediaSourcePlayer::OnDecoderStarved() {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 687
684 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { 688 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) {
685 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; 689 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")";
686 DCHECK_NE(event, NO_EVENT_PENDING); 690 DCHECK_NE(event, NO_EVENT_PENDING);
687 DCHECK(IsEventPending(event)); 691 DCHECK(IsEventPending(event));
688 692
689 pending_event_ &= ~event; 693 pending_event_ &= ~event;
690 } 694 }
691 695
692 } // namespace media 696 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698