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

Side by Side Diff: content/common/gpu/media/android_video_decode_accelerator.cc

Issue 1485043002: Passed is_encrypted parameter to the VDA initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years 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
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 "content/common/gpu/media/android_video_decode_accelerator.h" 5 #include "content/common/gpu/media/android_video_decode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return base::TimeDelta::FromMicroseconds(0); 74 return base::TimeDelta::FromMicroseconds(0);
75 } 75 }
76 76
77 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( 77 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
78 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, 78 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder,
79 const base::Callback<bool(void)>& make_context_current, 79 const base::Callback<bool(void)>& make_context_current,
80 scoped_ptr<BackingStrategy> strategy) 80 scoped_ptr<BackingStrategy> strategy)
81 : client_(NULL), 81 : client_(NULL),
82 make_context_current_(make_context_current), 82 make_context_current_(make_context_current),
83 codec_(media::kCodecH264), 83 codec_(media::kCodecH264),
84 is_encrypted_(false),
84 state_(NO_ERROR), 85 state_(NO_ERROR),
85 picturebuffers_requested_(false), 86 picturebuffers_requested_(false),
86 gl_decoder_(decoder), 87 gl_decoder_(decoder),
87 strategy_(strategy.Pass()), 88 strategy_(strategy.Pass()),
88 weak_this_factory_(this) {} 89 weak_this_factory_(this) {}
89 90
90 AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() { 91 AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() {
91 DCHECK(thread_checker_.CalledOnValidThread()); 92 DCHECK(thread_checker_.CalledOnValidThread());
92 } 93 }
93 94
94 bool AndroidVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, 95 bool AndroidVideoDecodeAccelerator::Initialize(const Config& config,
95 Client* client) { 96 Client* client) {
96 DCHECK(!media_codec_); 97 DCHECK(!media_codec_);
97 DCHECK(thread_checker_.CalledOnValidThread()); 98 DCHECK(thread_checker_.CalledOnValidThread());
98 TRACE_EVENT0("media", "AVDA::Initialize"); 99 TRACE_EVENT0("media", "AVDA::Initialize");
99 100
101 DVLOG(1) << __FUNCTION__ << ": profile:" << config.profile
102 << " is_encrypted:" << config.is_encrypted;
103
100 client_ = client; 104 client_ = client;
101 codec_ = VideoCodecProfileToVideoCodec(profile); 105 codec_ = VideoCodecProfileToVideoCodec(config.profile);
106 is_encrypted_ = config.is_encrypted;
102 107
103 bool profile_supported = codec_ == media::kCodecVP8; 108 bool profile_supported = codec_ == media::kCodecVP8;
104 #if defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) 109 #if defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
105 profile_supported |= 110 profile_supported |=
106 (codec_ == media::kCodecVP9 || codec_ == media::kCodecH264); 111 (codec_ == media::kCodecVP9 || codec_ == media::kCodecH264);
107 #endif 112 #endif
108 113
109 if (!profile_supported) { 114 if (!profile_supported) {
110 LOG(ERROR) << "Unsupported profile: " << profile; 115 LOG(ERROR) << "Unsupported profile: " << config.profile;
111 return false; 116 return false;
112 } 117 }
113 118
114 // Only use MediaCodec for VP8/9 if it's likely backed by hardware. 119 // Only use MediaCodec for VP8/9 if it's likely backed by hardware.
115 if ((codec_ == media::kCodecVP8 || codec_ == media::kCodecVP9) && 120 if ((codec_ == media::kCodecVP8 || codec_ == media::kCodecVP9) &&
116 media::VideoCodecBridge::IsKnownUnaccelerated( 121 media::VideoCodecBridge::IsKnownUnaccelerated(
117 codec_, media::MEDIA_CODEC_DECODER)) { 122 codec_, media::MEDIA_CODEC_DECODER)) {
118 DVLOG(1) << "Initialization failed: " 123 DVLOG(1) << "Initialization failed: "
119 << (codec_ == media::kCodecVP8 ? "vp8" : "vp9") 124 << (codec_ == media::kCodecVP8 ? "vp8" : "vp9")
120 << " is not hardware accelerated"; 125 << " is not hardware accelerated";
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // software fallback for H264 on Android anyway. 666 // software fallback for H264 on Android anyway.
662 profile.max_resolution.SetSize(3840, 2160); 667 profile.max_resolution.SetSize(3840, 2160);
663 profiles.push_back(profile); 668 profiles.push_back(profile);
664 } 669 }
665 #endif 670 #endif
666 671
667 return profiles; 672 return profiles;
668 } 673 }
669 674
670 } // namespace content 675 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698