OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/pepper/video_decoder_shim.h" | 5 #include "content/renderer/pepper/video_decoder_shim.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" |
16 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
17 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
19 #include "content/public/renderer/render_thread.h" | 20 #include "content/public/renderer/render_thread.h" |
20 #include "content/renderer/pepper/pepper_video_decoder_host.h" | 21 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
21 #include "content/renderer/render_thread_impl.h" | 22 #include "content/renderer/render_thread_impl.h" |
22 #include "gpu/command_buffer/client/gles2_interface.h" | 23 #include "gpu/command_buffer/client/gles2_interface.h" |
23 #include "media/base/cdm_context.h" | 24 #include "media/base/cdm_context.h" |
24 #include "media/base/decoder_buffer.h" | 25 #include "media/base/decoder_buffer.h" |
25 #include "media/base/limits.h" | 26 #include "media/base/limits.h" |
| 27 #include "media/base/media_log.h" |
26 #include "media/base/media_util.h" | 28 #include "media/base/media_util.h" |
27 #include "media/base/video_decoder.h" | 29 #include "media/base/video_decoder.h" |
28 #include "media/filters/ffmpeg_video_decoder.h" | 30 #include "media/filters/ffmpeg_video_decoder.h" |
29 #include "media/filters/vpx_video_decoder.h" | 31 #include "media/filters/vpx_video_decoder.h" |
30 #include "media/renderers/skcanvas_video_renderer.h" | 32 #include "media/renderers/skcanvas_video_renderer.h" |
31 #include "media/video/picture.h" | 33 #include "media/video/picture.h" |
32 #include "media/video/video_decode_accelerator.h" | 34 #include "media/video/video_decode_accelerator.h" |
33 #include "ppapi/c/pp_errors.h" | 35 #include "ppapi/c/pp_errors.h" |
34 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 36 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
35 #include "third_party/skia/include/gpu/GrTypes.h" | 37 #include "third_party/skia/include/gpu/GrTypes.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 DCHECK(!decoder_); | 690 DCHECK(!decoder_); |
689 #if !defined(MEDIA_DISABLE_LIBVPX) | 691 #if !defined(MEDIA_DISABLE_LIBVPX) |
690 if (config.codec() == media::kCodecVP9) { | 692 if (config.codec() == media::kCodecVP9) { |
691 decoder_.reset(new media::VpxVideoDecoder()); | 693 decoder_.reset(new media::VpxVideoDecoder()); |
692 } else | 694 } else |
693 #endif | 695 #endif |
694 | 696 |
695 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) | 697 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
696 { | 698 { |
697 std::unique_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( | 699 std::unique_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( |
698 new media::FFmpegVideoDecoder()); | 700 new media::FFmpegVideoDecoder(make_scoped_refptr(new MediaLog()))); |
699 ffmpeg_video_decoder->set_decode_nalus(true); | 701 ffmpeg_video_decoder->set_decode_nalus(true); |
700 decoder_ = std::move(ffmpeg_video_decoder); | 702 decoder_ = std::move(ffmpeg_video_decoder); |
701 } | 703 } |
702 #elif defined(MEDIA_DISABLE_LIBVPX) | 704 #elif defined(MEDIA_DISABLE_LIBVPX) |
703 OnInitDone(false); | 705 OnInitDone(false); |
704 return; | 706 return; |
705 #endif | 707 #endif |
706 | 708 |
707 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() | 709 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() |
708 // request. | 710 // request. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1119 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1120 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
1119 gles2->DeleteTextures(1, &texture_id); | 1121 gles2->DeleteTextures(1, &texture_id); |
1120 } | 1122 } |
1121 | 1123 |
1122 void VideoDecoderShim::FlushCommandBuffer() { | 1124 void VideoDecoderShim::FlushCommandBuffer() { |
1123 context_provider_->ContextGL()->Flush(); | 1125 context_provider_->ContextGL()->Flush(); |
1124 } | 1126 } |
1125 | 1127 |
1126 } // namespace content | 1128 } // namespace content |
OLD | NEW |