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

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

Issue 1499423004: Remove kint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint9
Patch Set: rebase 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 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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 profile.max_framerate_denominator = kMaxFramerateDenominator; 139 profile.max_framerate_denominator = kMaxFramerateDenominator;
140 profiles.push_back(profile); 140 profiles.push_back(profile);
141 } 141 }
142 return profiles; 142 return profiles;
143 } 143 }
144 144
145 bool AndroidVideoEncodeAccelerator::Initialize( 145 bool AndroidVideoEncodeAccelerator::Initialize(
146 media::VideoPixelFormat format, 146 media::VideoPixelFormat format,
147 const gfx::Size& input_visible_size, 147 const gfx::Size& input_visible_size,
148 media::VideoCodecProfile output_profile, 148 media::VideoCodecProfile output_profile,
149 uint32 initial_bitrate, 149 uint32_t initial_bitrate,
150 Client* client) { 150 Client* client) {
151 DVLOG(3) << __PRETTY_FUNCTION__ << " format: " << format 151 DVLOG(3) << __PRETTY_FUNCTION__ << " format: " << format
152 << ", input_visible_size: " << input_visible_size.ToString() 152 << ", input_visible_size: " << input_visible_size.ToString()
153 << ", output_profile: " << output_profile 153 << ", output_profile: " << output_profile
154 << ", initial_bitrate: " << initial_bitrate; 154 << ", initial_bitrate: " << initial_bitrate;
155 DCHECK(!media_codec_); 155 DCHECK(!media_codec_);
156 DCHECK(thread_checker_.CalledOnValidThread()); 156 DCHECK(thread_checker_.CalledOnValidThread());
157 157
158 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); 158 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
159 159
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitstream_buffer_id=" << buffer.id(); 262 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitstream_buffer_id=" << buffer.id();
263 DCHECK(thread_checker_.CalledOnValidThread()); 263 DCHECK(thread_checker_.CalledOnValidThread());
264 RETURN_ON_FAILURE(buffer.size() >= media_codec_->GetOutputBuffersCapacity(), 264 RETURN_ON_FAILURE(buffer.size() >= media_codec_->GetOutputBuffersCapacity(),
265 "Output buffers too small!", 265 "Output buffers too small!",
266 kInvalidArgumentError); 266 kInvalidArgumentError);
267 available_bitstream_buffers_.push_back(buffer); 267 available_bitstream_buffers_.push_back(buffer);
268 DoIOTask(); 268 DoIOTask();
269 } 269 }
270 270
271 void AndroidVideoEncodeAccelerator::RequestEncodingParametersChange( 271 void AndroidVideoEncodeAccelerator::RequestEncodingParametersChange(
272 uint32 bitrate, 272 uint32_t bitrate,
273 uint32 framerate) { 273 uint32_t framerate) {
274 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitrate: " << bitrate 274 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitrate: " << bitrate
275 << ", framerate: " << framerate; 275 << ", framerate: " << framerate;
276 DCHECK(thread_checker_.CalledOnValidThread()); 276 DCHECK(thread_checker_.CalledOnValidThread());
277 if (bitrate != last_set_bitrate_) { 277 if (bitrate != last_set_bitrate_) {
278 last_set_bitrate_ = bitrate; 278 last_set_bitrate_ = bitrate;
279 media_codec_->SetVideoBitrate(bitrate); 279 media_codec_->SetVideoBitrate(bitrate);
280 } 280 }
281 // Note: Android's MediaCodec doesn't allow mid-stream adjustments to 281 // Note: Android's MediaCodec doesn't allow mid-stream adjustments to
282 // framerate, so we ignore that here. This is OK because Android only uses 282 // framerate, so we ignore that here. This is OK because Android only uses
283 // the framerate value from MediaFormat during configure() as a proxy for 283 // the framerate value from MediaFormat during configure() as a proxy for
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 UMA_HISTOGRAM_BOOLEAN("Media.AVEA.OutputBuffersSuffice", ret); 387 UMA_HISTOGRAM_BOOLEAN("Media.AVEA.OutputBuffersSuffice", ret);
388 return ret; 388 return ret;
389 } 389 }
390 390
391 void AndroidVideoEncodeAccelerator::DequeueOutput() { 391 void AndroidVideoEncodeAccelerator::DequeueOutput() {
392 if (!client_ptr_factory_->GetWeakPtr() || 392 if (!client_ptr_factory_->GetWeakPtr() ||
393 available_bitstream_buffers_.empty() || num_buffers_at_codec_ == 0) { 393 available_bitstream_buffers_.empty() || num_buffers_at_codec_ == 0) {
394 return; 394 return;
395 } 395 }
396 396
397 int32 buf_index = 0; 397 int32_t buf_index = 0;
398 size_t offset = 0; 398 size_t offset = 0;
399 size_t size = 0; 399 size_t size = 0;
400 bool key_frame = false; 400 bool key_frame = false;
401 do { 401 do {
402 media::MediaCodecStatus status = media_codec_->DequeueOutputBuffer( 402 media::MediaCodecStatus status = media_codec_->DequeueOutputBuffer(
403 NoWaitTimeOut(), &buf_index, &offset, &size, NULL, NULL, &key_frame); 403 NoWaitTimeOut(), &buf_index, &offset, &size, NULL, NULL, &key_frame);
404 switch (status) { 404 switch (status) {
405 case media::MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER: 405 case media::MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER:
406 return; 406 return;
407 407
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 base::MessageLoop::current()->PostTask( 447 base::MessageLoop::current()->PostTask(
448 FROM_HERE, 448 FROM_HERE,
449 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 449 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
450 client_ptr_factory_->GetWeakPtr(), 450 client_ptr_factory_->GetWeakPtr(),
451 bitstream_buffer.id(), 451 bitstream_buffer.id(),
452 size, 452 size,
453 key_frame)); 453 key_frame));
454 } 454 }
455 455
456 } // namespace content 456 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698