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

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

Issue 418193003: Using PROFILE_ANY for vp8 and vp9 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 for (size_t i = 0; i < codecs_info.size(); ++i) { 94 for (size_t i = 0; i < codecs_info.size(); ++i) {
95 const MediaCodecBridge::CodecsInfo& info = codecs_info[i]; 95 const MediaCodecBridge::CodecsInfo& info = codecs_info[i];
96 if (info.direction != media::MEDIA_CODEC_ENCODER || info.codecs != "vp8" || 96 if (info.direction != media::MEDIA_CODEC_ENCODER || info.codecs != "vp8" ||
97 VideoCodecBridge::IsKnownUnaccelerated(media::kCodecVP8, 97 VideoCodecBridge::IsKnownUnaccelerated(media::kCodecVP8,
98 media::MEDIA_CODEC_ENCODER)) { 98 media::MEDIA_CODEC_ENCODER)) {
99 // We're only looking for a HW VP8 encoder. 99 // We're only looking for a HW VP8 encoder.
100 continue; 100 continue;
101 } 101 }
102 SupportedProfile profile; 102 SupportedProfile profile;
103 profile.profile = media::VP8PROFILE_MAIN; 103 profile.profile = media::VP8PROFILE_ANY;
104 // Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the 104 // 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 105 // encoder? Sure would be. Too bad it doesn't. So we hard-code some
106 // reasonable defaults. 106 // reasonable defaults.
107 profile.max_resolution.SetSize(1920, 1088); 107 profile.max_resolution.SetSize(1920, 1088);
108 profile.max_framerate.numerator = 30; 108 profile.max_framerate.numerator = 30;
109 profile.max_framerate.denominator = 1; 109 profile.max_framerate.denominator = 1;
110 profiles.push_back(profile); 110 profiles.push_back(profile);
111 } 111 }
112 return profiles; 112 return profiles;
113 } 113 }
114 114
115 bool AndroidVideoEncodeAccelerator::Initialize( 115 bool AndroidVideoEncodeAccelerator::Initialize(
116 VideoFrame::Format format, 116 VideoFrame::Format format,
117 const gfx::Size& input_visible_size, 117 const gfx::Size& input_visible_size,
118 media::VideoCodecProfile output_profile, 118 media::VideoCodecProfile output_profile,
119 uint32 initial_bitrate, 119 uint32 initial_bitrate,
120 Client* client) { 120 Client* client) {
121 DVLOG(3) << __PRETTY_FUNCTION__ << " format: " << format 121 DVLOG(3) << __PRETTY_FUNCTION__ << " format: " << format
122 << ", input_visible_size: " << input_visible_size.ToString() 122 << ", input_visible_size: " << input_visible_size.ToString()
123 << ", output_profile: " << output_profile 123 << ", output_profile: " << output_profile
124 << ", initial_bitrate: " << initial_bitrate; 124 << ", initial_bitrate: " << initial_bitrate;
125 DCHECK(!media_codec_); 125 DCHECK(!media_codec_);
126 DCHECK(thread_checker_.CalledOnValidThread()); 126 DCHECK(thread_checker_.CalledOnValidThread());
127 127
128 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); 128 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
129 129
130 if (!(media::MediaCodecBridge::SupportsSetParameters() && 130 if (!(media::MediaCodecBridge::SupportsSetParameters() &&
131 format == VideoFrame::I420 && 131 format == VideoFrame::I420 &&
132 output_profile == media::VP8PROFILE_MAIN)) { 132 output_profile == media::VP8PROFILE_ANY)) {
133 DLOG(ERROR) << "Unexpected combo: " << format << ", " << output_profile; 133 DLOG(ERROR) << "Unexpected combo: " << format << ", " << output_profile;
134 return false; 134 return false;
135 } 135 }
136 136
137 last_set_bitrate_ = initial_bitrate; 137 last_set_bitrate_ = initial_bitrate;
138 138
139 // Only consider using MediaCodec if it's likely backed by hardware. 139 // Only consider using MediaCodec if it's likely backed by hardware.
140 if (media::VideoCodecBridge::IsKnownUnaccelerated( 140 if (media::VideoCodecBridge::IsKnownUnaccelerated(
141 media::kCodecVP8, media::MEDIA_CODEC_ENCODER)) { 141 media::kCodecVP8, media::MEDIA_CODEC_ENCODER)) {
142 DLOG(ERROR) << "No HW support"; 142 DLOG(ERROR) << "No HW support";
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 base::MessageLoop::current()->PostTask( 404 base::MessageLoop::current()->PostTask(
405 FROM_HERE, 405 FROM_HERE,
406 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 406 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
407 client_ptr_factory_->GetWeakPtr(), 407 client_ptr_factory_->GetWeakPtr(),
408 bitstream_buffer.id(), 408 bitstream_buffer.id(),
409 size, 409 size,
410 key_frame)); 410 key_frame));
411 } 411 }
412 412
413 } // namespace content 413 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698