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

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

Issue 568413002: Add VEA supported profiles to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address piman's comment -- create codecs_ lazily Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_encode_accelerator.h" 5 #include "content/common/gpu/media/android_video_encode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 AndroidVideoEncodeAccelerator::AndroidVideoEncodeAccelerator() 70 AndroidVideoEncodeAccelerator::AndroidVideoEncodeAccelerator()
71 : num_buffers_at_codec_(0), 71 : num_buffers_at_codec_(0),
72 num_output_buffers_(-1), 72 num_output_buffers_(-1),
73 output_buffers_capacity_(0), 73 output_buffers_capacity_(0),
74 last_set_bitrate_(0) {} 74 last_set_bitrate_(0) {}
75 75
76 AndroidVideoEncodeAccelerator::~AndroidVideoEncodeAccelerator() { 76 AndroidVideoEncodeAccelerator::~AndroidVideoEncodeAccelerator() {
77 DCHECK(thread_checker_.CalledOnValidThread()); 77 DCHECK(thread_checker_.CalledOnValidThread());
78 } 78 }
79 79
80 // static
81 std::vector<media::VideoEncodeAccelerator::SupportedProfile> 80 std::vector<media::VideoEncodeAccelerator::SupportedProfile>
82 AndroidVideoEncodeAccelerator::GetSupportedProfiles() { 81 AndroidVideoEncodeAccelerator::GetSupportedProfiles() {
83 std::vector<MediaCodecBridge::CodecsInfo> codecs_info = 82 std::vector<MediaCodecBridge::CodecsInfo> codecs_info =
84 MediaCodecBridge::GetCodecsInfo(); 83 MediaCodecBridge::GetCodecsInfo();
85 84
86 std::vector<SupportedProfile> profiles; 85 std::vector<SupportedProfile> profiles;
87 86
88 #if defined(ENABLE_WEBRTC) 87 #if defined(ENABLE_WEBRTC)
89 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 88 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
90 if (cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) 89 if (cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
91 return profiles; 90 return profiles;
92 #endif 91 #endif
93 92
94 for (size_t i = 0; i < codecs_info.size(); ++i) { 93 for (size_t i = 0; i < codecs_info.size(); ++i) {
95 const MediaCodecBridge::CodecsInfo& info = codecs_info[i]; 94 const MediaCodecBridge::CodecsInfo& info = codecs_info[i];
96 if (info.direction != media::MEDIA_CODEC_ENCODER || info.codecs != "vp8" || 95 if (info.direction != media::MEDIA_CODEC_ENCODER || info.codecs != "vp8" ||
97 VideoCodecBridge::IsKnownUnaccelerated(media::kCodecVP8, 96 VideoCodecBridge::IsKnownUnaccelerated(media::kCodecVP8,
98 media::MEDIA_CODEC_ENCODER)) { 97 media::MEDIA_CODEC_ENCODER)) {
99 // We're only looking for a HW VP8 encoder. 98 // We're only looking for a HW VP8 encoder.
100 continue; 99 continue;
101 } 100 }
102 SupportedProfile profile; 101 SupportedProfile profile;
103 profile.profile = media::VP8PROFILE_ANY; 102 profile.profile = media::VP8PROFILE_ANY;
104 // Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the 103 // Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the
105 // encoder? Sure would be. Too bad it doesn't. So we hard-code some 104 // encoder? Sure would be. Too bad it doesn't. So we hard-code some
106 // reasonable defaults. 105 // reasonable defaults.
107 profile.max_resolution.SetSize(1920, 1088); 106 profile.max_resolution.SetSize(1920, 1088);
108 profile.max_framerate.numerator = 30; 107 profile.max_framerate_numerator = 30;
109 profile.max_framerate.denominator = 1; 108 profile.max_framerate_denominator = 1;
110 profiles.push_back(profile); 109 profiles.push_back(profile);
111 } 110 }
112 return profiles; 111 return profiles;
113 } 112 }
114 113
115 bool AndroidVideoEncodeAccelerator::Initialize( 114 bool AndroidVideoEncodeAccelerator::Initialize(
116 VideoFrame::Format format, 115 VideoFrame::Format format,
117 const gfx::Size& input_visible_size, 116 const gfx::Size& input_visible_size,
118 media::VideoCodecProfile output_profile, 117 media::VideoCodecProfile output_profile,
119 uint32 initial_bitrate, 118 uint32 initial_bitrate,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 base::MessageLoop::current()->PostTask( 403 base::MessageLoop::current()->PostTask(
405 FROM_HERE, 404 FROM_HERE,
406 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 405 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
407 client_ptr_factory_->GetWeakPtr(), 406 client_ptr_factory_->GetWeakPtr(),
408 bitstream_buffer.id(), 407 bitstream_buffer.id(),
409 size, 408 size,
410 key_frame)); 409 key_frame));
411 } 410 }
412 411
413 } // namespace content 412 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698