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

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

Issue 1831323002: media: AVDA now always notifies the end of consumed bitstream buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_decode_accelerator.h" 5 #include "content/common/gpu/media/android_video_decode_accelerator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 DVLOG(1) << "QueueSecureInputBuffer failed: NO_KEY"; 529 DVLOG(1) << "QueueSecureInputBuffer failed: NO_KEY";
530 pending_input_buf_index_ = input_buf_index; 530 pending_input_buf_index_ = input_buf_index;
531 state_ = WAITING_FOR_KEY; 531 state_ = WAITING_FOR_KEY;
532 return false; 532 return false;
533 } 533 }
534 534
535 pending_input_buf_index_ = -1; 535 pending_input_buf_index_ = -1;
536 pending_bitstream_buffers_.pop(); 536 pending_bitstream_buffers_.pop();
537 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", 537 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount",
538 pending_bitstream_buffers_.size()); 538 pending_bitstream_buffers_.size());
539
540 if (status != media::MEDIA_CODEC_OK) {
541 POST_ERROR(PLATFORM_FAILURE, "Failed to QueueInputBuffer: " << status);
542 return false;
543 }
544
545 // We should call NotifyEndOfBitstreamBuffer(), when no more decoded output 539 // We should call NotifyEndOfBitstreamBuffer(), when no more decoded output
546 // will be returned from the bitstream buffer. However, MediaCodec API is 540 // will be returned from the bitstream buffer. However, MediaCodec API is
547 // not enough to guarantee it. 541 // not enough to guarantee it.
548 // So, here, we calls NotifyEndOfBitstreamBuffer() in advance in order to 542 // So, here, we calls NotifyEndOfBitstreamBuffer() in advance in order to
549 // keep getting more bitstreams from the client, and throttle them by using 543 // keep getting more bitstreams from the client, and throttle them by using
550 // |bitstreams_notified_in_advance_|. 544 // |bitstreams_notified_in_advance_|.
551 // TODO(dwkang): check if there is a way to remove this workaround. 545 // TODO(dwkang): check if there is a way to remove this workaround.
552 base::MessageLoop::current()->PostTask( 546 base::MessageLoop::current()->PostTask(
553 FROM_HERE, 547 FROM_HERE,
554 base::Bind(&AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer, 548 base::Bind(&AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer,
555 weak_this_factory_.GetWeakPtr(), bitstream_buffer.id())); 549 weak_this_factory_.GetWeakPtr(), bitstream_buffer.id()));
556 bitstreams_notified_in_advance_.push_back(bitstream_buffer.id()); 550 bitstreams_notified_in_advance_.push_back(bitstream_buffer.id());
liberato (no reviews please) 2016/03/29 20:17:25 i was going to say that |bitstreams_notified_in_ad
557 551
552 if (status != media::MEDIA_CODEC_OK) {
553 POST_ERROR(PLATFORM_FAILURE, "Failed to QueueInputBuffer: " << status);
554 return false;
555 }
556
558 return true; 557 return true;
559 } 558 }
560 559
561 bool AndroidVideoDecodeAccelerator::DequeueOutput() { 560 bool AndroidVideoDecodeAccelerator::DequeueOutput() {
562 DCHECK(thread_checker_.CalledOnValidThread()); 561 DCHECK(thread_checker_.CalledOnValidThread());
563 TRACE_EVENT0("media", "AVDA::DequeueOutput"); 562 TRACE_EVENT0("media", "AVDA::DequeueOutput");
564 base::AutoReset<bool> auto_reset(&defer_errors_, true); 563 base::AutoReset<bool> auto_reset(&defer_errors_, true);
565 if (picturebuffers_requested_ && output_picture_buffers_.empty()) 564 if (picturebuffers_requested_ && output_picture_buffers_.empty())
566 return false; 565 return false;
567 566
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: 1212 capabilities.flags = media::VideoDecodeAccelerator::Capabilities::
1214 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | 1213 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE |
1215 media::VideoDecodeAccelerator::Capabilities:: 1214 media::VideoDecodeAccelerator::Capabilities::
1216 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; 1215 SUPPORTS_EXTERNAL_OUTPUT_SURFACE;
1217 } 1216 }
1218 1217
1219 return capabilities; 1218 return capabilities;
1220 } 1219 }
1221 1220
1222 } // namespace content 1221 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698