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

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: rebase Created 6 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 ++num_buffers_at_codec_; 371 ++num_buffers_at_codec_;
372 pending_frames_.pop(); 372 pending_frames_.pop();
373 } 373 }
374 374
375 bool AndroidVideoEncodeAccelerator::DoOutputBuffersSuffice() { 375 bool AndroidVideoEncodeAccelerator::DoOutputBuffersSuffice() {
376 // If this returns false ever, then the VEA::Client interface will need to 376 // If this returns false ever, then the VEA::Client interface will need to
377 // grow a DismissBitstreamBuffer() call, and VEA::Client impls will have to be 377 // grow a DismissBitstreamBuffer() call, and VEA::Client impls will have to be
378 // prepared to field multiple requests to RequireBitstreamBuffers(). 378 // prepared to field multiple requests to RequireBitstreamBuffers().
379 int count = media_codec_->GetOutputBuffersCount(); 379 int count = media_codec_->GetOutputBuffersCount();
380 size_t capacity = media_codec_->GetOutputBuffersCapacity(); 380 size_t capacity = media_codec_->GetOutputBuffersCapacity();
381 bool ret = media_codec_->GetOutputBuffers() && count <= num_output_buffers_ && 381 bool ret = count <= num_output_buffers_ &&
382 capacity <= output_buffers_capacity_; 382 capacity <= output_buffers_capacity_;
383 LOG_IF(ERROR, !ret) << "Need more/bigger buffers; before: " 383 LOG_IF(ERROR, !ret) << "Need more/bigger buffers; before: "
384 << num_output_buffers_ << "x" << output_buffers_capacity_ 384 << num_output_buffers_ << "x" << output_buffers_capacity_
385 << ", now: " << count << "x" << capacity; 385 << ", now: " << count << "x" << capacity;
386 UMA_HISTOGRAM_BOOLEAN("Media.AVEA.OutputBuffersSuffice", ret); 386 UMA_HISTOGRAM_BOOLEAN("Media.AVEA.OutputBuffersSuffice", ret);
387 return ret; 387 return ret;
388 } 388 }
389 389
390 void AndroidVideoEncodeAccelerator::DequeueOutput() { 390 void AndroidVideoEncodeAccelerator::DequeueOutput() {
391 if (!client_ptr_factory_->GetWeakPtr() || 391 if (!client_ptr_factory_->GetWeakPtr() ||
392 available_bitstream_buffers_.empty() || num_buffers_at_codec_ == 0) { 392 available_bitstream_buffers_.empty() || num_buffers_at_codec_ == 0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 base::MessageLoop::current()->PostTask( 446 base::MessageLoop::current()->PostTask(
447 FROM_HERE, 447 FROM_HERE,
448 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 448 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
449 client_ptr_factory_->GetWeakPtr(), 449 client_ptr_factory_->GetWeakPtr(),
450 bitstream_buffer.id(), 450 bitstream_buffer.id(),
451 size, 451 size,
452 key_frame)); 452 key_frame));
453 } 453 }
454 454
455 } // namespace content 455 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698