| OLD | NEW |
| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 DVLOG(1) << "QueueSecureInputBuffer failed: NO_KEY"; | 533 DVLOG(1) << "QueueSecureInputBuffer failed: NO_KEY"; |
| 534 pending_input_buf_index_ = input_buf_index; | 534 pending_input_buf_index_ = input_buf_index; |
| 535 state_ = WAITING_FOR_KEY; | 535 state_ = WAITING_FOR_KEY; |
| 536 return false; | 536 return false; |
| 537 } | 537 } |
| 538 | 538 |
| 539 pending_input_buf_index_ = -1; | 539 pending_input_buf_index_ = -1; |
| 540 pending_bitstream_buffers_.pop(); | 540 pending_bitstream_buffers_.pop(); |
| 541 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", | 541 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", |
| 542 pending_bitstream_buffers_.size()); | 542 pending_bitstream_buffers_.size()); |
| 543 | |
| 544 if (status != media::MEDIA_CODEC_OK) { | |
| 545 POST_ERROR(PLATFORM_FAILURE, "Failed to QueueInputBuffer: " << status); | |
| 546 return false; | |
| 547 } | |
| 548 | |
| 549 // We should call NotifyEndOfBitstreamBuffer(), when no more decoded output | 543 // We should call NotifyEndOfBitstreamBuffer(), when no more decoded output |
| 550 // will be returned from the bitstream buffer. However, MediaCodec API is | 544 // will be returned from the bitstream buffer. However, MediaCodec API is |
| 551 // not enough to guarantee it. | 545 // not enough to guarantee it. |
| 552 // So, here, we calls NotifyEndOfBitstreamBuffer() in advance in order to | 546 // So, here, we calls NotifyEndOfBitstreamBuffer() in advance in order to |
| 553 // keep getting more bitstreams from the client, and throttle them by using | 547 // keep getting more bitstreams from the client, and throttle them by using |
| 554 // |bitstreams_notified_in_advance_|. | 548 // |bitstreams_notified_in_advance_|. |
| 555 // TODO(dwkang): check if there is a way to remove this workaround. | 549 // TODO(dwkang): check if there is a way to remove this workaround. |
| 556 base::MessageLoop::current()->PostTask( | 550 base::MessageLoop::current()->PostTask( |
| 557 FROM_HERE, | 551 FROM_HERE, |
| 558 base::Bind(&AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer, | 552 base::Bind(&AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer, |
| 559 weak_this_factory_.GetWeakPtr(), bitstream_buffer.id())); | 553 weak_this_factory_.GetWeakPtr(), bitstream_buffer.id())); |
| 560 bitstreams_notified_in_advance_.push_back(bitstream_buffer.id()); | 554 bitstreams_notified_in_advance_.push_back(bitstream_buffer.id()); |
| 561 | 555 |
| 556 if (status != media::MEDIA_CODEC_OK) { |
| 557 POST_ERROR(PLATFORM_FAILURE, "Failed to QueueInputBuffer: " << status); |
| 558 return false; |
| 559 } |
| 560 |
| 562 return true; | 561 return true; |
| 563 } | 562 } |
| 564 | 563 |
| 565 bool AndroidVideoDecodeAccelerator::DequeueOutput() { | 564 bool AndroidVideoDecodeAccelerator::DequeueOutput() { |
| 566 DCHECK(thread_checker_.CalledOnValidThread()); | 565 DCHECK(thread_checker_.CalledOnValidThread()); |
| 567 TRACE_EVENT0("media", "AVDA::DequeueOutput"); | 566 TRACE_EVENT0("media", "AVDA::DequeueOutput"); |
| 568 base::AutoReset<bool> auto_reset(&defer_errors_, true); | 567 base::AutoReset<bool> auto_reset(&defer_errors_, true); |
| 569 if (picturebuffers_requested_ && output_picture_buffers_.empty()) | 568 if (picturebuffers_requested_ && output_picture_buffers_.empty()) |
| 570 return false; | 569 return false; |
| 571 | 570 |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1160 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1162 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1161 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1163 media::VideoDecodeAccelerator::Capabilities:: | 1162 media::VideoDecodeAccelerator::Capabilities:: |
| 1164 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1163 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1165 } | 1164 } |
| 1166 | 1165 |
| 1167 return capabilities; | 1166 return capabilities; |
| 1168 } | 1167 } |
| 1169 | 1168 |
| 1170 } // namespace content | 1169 } // namespace content |
| OLD | NEW |