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

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

Issue 669623004: Switch to Lollipop APIs for MediaCodec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove getInputBufferCount() call Created 6 years, 2 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 ++num_buffers_at_codec_; 328 ++num_buffers_at_codec_;
329 pending_frames_.pop(); 329 pending_frames_.pop();
330 } 330 }
331 331
332 bool AndroidVideoEncodeAccelerator::DoOutputBuffersSuffice() { 332 bool AndroidVideoEncodeAccelerator::DoOutputBuffersSuffice() {
333 // If this returns false ever, then the VEA::Client interface will need to 333 // If this returns false ever, then the VEA::Client interface will need to
334 // grow a DismissBitstreamBuffer() call, and VEA::Client impls will have to be 334 // grow a DismissBitstreamBuffer() call, and VEA::Client impls will have to be
335 // prepared to field multiple requests to RequireBitstreamBuffers(). 335 // prepared to field multiple requests to RequireBitstreamBuffers().
336 int count = media_codec_->GetOutputBuffersCount(); 336 int count = media_codec_->GetOutputBuffersCount();
337 size_t capacity = media_codec_->GetOutputBuffersCapacity(); 337 size_t capacity = media_codec_->GetOutputBuffersCapacity();
338 bool ret = media_codec_->GetOutputBuffers() && count <= num_output_buffers_ && 338 bool ret = count <= num_output_buffers_ &&
339 capacity <= output_buffers_capacity_; 339 capacity <= output_buffers_capacity_;
340 LOG_IF(ERROR, !ret) << "Need more/bigger buffers; before: " 340 LOG_IF(ERROR, !ret) << "Need more/bigger buffers; before: "
341 << num_output_buffers_ << "x" << output_buffers_capacity_ 341 << num_output_buffers_ << "x" << output_buffers_capacity_
342 << ", now: " << count << "x" << capacity; 342 << ", now: " << count << "x" << capacity;
343 UMA_HISTOGRAM_BOOLEAN("Media.AVEA.OutputBuffersSuffice", ret); 343 UMA_HISTOGRAM_BOOLEAN("Media.AVEA.OutputBuffersSuffice", ret);
344 return ret; 344 return ret;
345 } 345 }
346 346
347 void AndroidVideoEncodeAccelerator::DequeueOutput() { 347 void AndroidVideoEncodeAccelerator::DequeueOutput() {
348 if (!client_ptr_factory_->GetWeakPtr() || 348 if (!client_ptr_factory_->GetWeakPtr() ||
349 available_bitstream_buffers_.empty() || num_buffers_at_codec_ == 0) { 349 available_bitstream_buffers_.empty() || num_buffers_at_codec_ == 0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 base::MessageLoop::current()->PostTask( 403 base::MessageLoop::current()->PostTask(
404 FROM_HERE, 404 FROM_HERE,
405 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 405 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
406 client_ptr_factory_->GetWeakPtr(), 406 client_ptr_factory_->GetWeakPtr(),
407 bitstream_buffer.id(), 407 bitstream_buffer.id(),
408 size, 408 size,
409 key_frame)); 409 key_frame));
410 } 410 }
411 411
412 } // namespace content 412 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698