| 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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 19 #include "content/common/gpu/gpu_channel.h" | 19 #include "content/common/gpu/gpu_channel.h" |
| 20 #include "content/common/gpu/media/android_copying_backing_strategy.h" | 20 #include "content/common/gpu/media/android_copying_backing_strategy.h" |
| 21 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" | 21 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" |
| 22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 23 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 23 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 24 #include "gpu/command_buffer/service/gpu_switches.h" | 24 #include "gpu/command_buffer/service/gpu_switches.h" |
| 25 #include "gpu/command_buffer/service/mailbox_manager.h" | 25 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 26 #include "media/base/android/media_codec_bridge.h" |
| 26 #include "media/base/android/media_codec_util.h" | 27 #include "media/base/android/media_codec_util.h" |
| 27 #include "media/base/bind_to_current_loop.h" | 28 #include "media/base/bind_to_current_loop.h" |
| 28 #include "media/base/bitstream_buffer.h" | 29 #include "media/base/bitstream_buffer.h" |
| 29 #include "media/base/limits.h" | 30 #include "media/base/limits.h" |
| 30 #include "media/base/media.h" | 31 #include "media/base/media.h" |
| 31 #include "media/base/media_switches.h" | 32 #include "media/base/media_switches.h" |
| 32 #include "media/base/timestamp_constants.h" | 33 #include "media/base/timestamp_constants.h" |
| 33 #include "media/base/video_decoder_config.h" | 34 #include "media/base/video_decoder_config.h" |
| 34 #include "media/video/picture.h" | 35 #include "media/video/picture.h" |
| 35 #include "ui/gl/android/scoped_java_surface.h" | 36 #include "ui/gl/android/scoped_java_surface.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 586 |
| 586 case media::MEDIA_CODEC_OUTPUT_FORMAT_CHANGED: { | 587 case media::MEDIA_CODEC_OUTPUT_FORMAT_CHANGED: { |
| 587 if (!output_picture_buffers_.empty()) { | 588 if (!output_picture_buffers_.empty()) { |
| 588 // TODO(chcunningham): This will likely dismiss a handful of decoded | 589 // TODO(chcunningham): This will likely dismiss a handful of decoded |
| 589 // frames that have not yet been drawn and returned to us for re-use. | 590 // frames that have not yet been drawn and returned to us for re-use. |
| 590 // Consider a more complicated design that would wait for them to be | 591 // Consider a more complicated design that would wait for them to be |
| 591 // drawn before dismissing. | 592 // drawn before dismissing. |
| 592 DismissPictureBuffers(); | 593 DismissPictureBuffers(); |
| 593 } | 594 } |
| 594 | 595 |
| 596 if (media_codec_->GetOutputSize(&size_) != media::MEDIA_CODEC_OK) { |
| 597 POST_ERROR(PLATFORM_FAILURE, "GetOutputSize failed."); |
| 598 return false; |
| 599 } |
| 600 |
| 595 picturebuffers_requested_ = true; | 601 picturebuffers_requested_ = true; |
| 596 int32_t width, height; | |
| 597 media_codec_->GetOutputFormat(&width, &height); | |
| 598 size_ = gfx::Size(width, height); | |
| 599 base::MessageLoop::current()->PostTask( | 602 base::MessageLoop::current()->PostTask( |
| 600 FROM_HERE, | 603 FROM_HERE, |
| 601 base::Bind(&AndroidVideoDecodeAccelerator::RequestPictureBuffers, | 604 base::Bind(&AndroidVideoDecodeAccelerator::RequestPictureBuffers, |
| 602 weak_this_factory_.GetWeakPtr())); | 605 weak_this_factory_.GetWeakPtr())); |
| 603 return false; | 606 return false; |
| 604 } | 607 } |
| 605 | 608 |
| 606 case media::MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED: | 609 case media::MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED: |
| 607 break; | 610 break; |
| 608 | 611 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1148 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1146 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1149 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1147 media::VideoDecodeAccelerator::Capabilities:: | 1150 media::VideoDecodeAccelerator::Capabilities:: |
| 1148 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1151 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1149 } | 1152 } |
| 1150 | 1153 |
| 1151 return capabilities; | 1154 return capabilities; |
| 1152 } | 1155 } |
| 1153 | 1156 |
| 1154 } // namespace content | 1157 } // namespace content |
| OLD | NEW |