| 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 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #ifndef NDEBUG | 14 #ifndef NDEBUG |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #endif | 16 #endif |
| 17 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "cc/blink/context_provider_web_context.h" | 19 #include "cc/blink/context_provider_web_context.h" |
| 20 #include "content/public/renderer/render_thread.h" | 20 #include "content/public/renderer/render_thread.h" |
| 21 #include "content/renderer/pepper/pepper_video_decoder_host.h" | 21 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
| 22 #include "content/renderer/render_thread_impl.h" | 22 #include "content/renderer/render_thread_impl.h" |
| 23 #include "gpu/command_buffer/client/gles2_implementation.h" | 23 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 24 #include "media/base/cdm_context.h" | |
| 25 #include "media/base/decoder_buffer.h" | 24 #include "media/base/decoder_buffer.h" |
| 26 #include "media/base/limits.h" | 25 #include "media/base/limits.h" |
| 27 #include "media/base/media_util.h" | 26 #include "media/base/media_util.h" |
| 28 #include "media/base/video_decoder.h" | 27 #include "media/base/video_decoder.h" |
| 29 #include "media/filters/ffmpeg_video_decoder.h" | 28 #include "media/filters/ffmpeg_video_decoder.h" |
| 30 #include "media/filters/vpx_video_decoder.h" | 29 #include "media/filters/vpx_video_decoder.h" |
| 31 #include "media/renderers/skcanvas_video_renderer.h" | 30 #include "media/renderers/skcanvas_video_renderer.h" |
| 32 #include "media/video/picture.h" | 31 #include "media/video/picture.h" |
| 33 #include "media/video/video_decode_accelerator.h" | 32 #include "media/video/video_decode_accelerator.h" |
| 34 #include "ppapi/c/pp_errors.h" | 33 #include "ppapi/c/pp_errors.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 new media::FFmpegVideoDecoder(base::ThreadTaskRunnerHandle::Get())); | 693 new media::FFmpegVideoDecoder(base::ThreadTaskRunnerHandle::Get())); |
| 695 ffmpeg_video_decoder->set_decode_nalus(true); | 694 ffmpeg_video_decoder->set_decode_nalus(true); |
| 696 decoder_ = ffmpeg_video_decoder.Pass(); | 695 decoder_ = ffmpeg_video_decoder.Pass(); |
| 697 } | 696 } |
| 698 | 697 |
| 699 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() | 698 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() |
| 700 // request. | 699 // request. |
| 701 DCHECK_EQ(decoder_->GetMaxDecodeRequests(), 1); | 700 DCHECK_EQ(decoder_->GetMaxDecodeRequests(), 1); |
| 702 | 701 |
| 703 decoder_->Initialize( | 702 decoder_->Initialize( |
| 704 config, true /* low_delay */, media::SetCdmReadyCB(), | 703 config, true /* low_delay */, |
| 705 base::Bind(&VideoDecoderShim::DecoderImpl::OnInitDone, | 704 base::Bind(&VideoDecoderShim::DecoderImpl::OnInitDone, |
| 706 weak_ptr_factory_.GetWeakPtr()), | 705 weak_ptr_factory_.GetWeakPtr()), |
| 707 base::Bind(&VideoDecoderShim::DecoderImpl::OnOutputComplete, | 706 base::Bind(&VideoDecoderShim::DecoderImpl::OnOutputComplete, |
| 708 weak_ptr_factory_.GetWeakPtr())); | 707 weak_ptr_factory_.GetWeakPtr())); |
| 709 } | 708 } |
| 710 | 709 |
| 711 void VideoDecoderShim::DecoderImpl::Decode( | 710 void VideoDecoderShim::DecoderImpl::Decode( |
| 712 uint32_t decode_id, | 711 uint32_t decode_id, |
| 713 scoped_refptr<media::DecoderBuffer> buffer) { | 712 scoped_refptr<media::DecoderBuffer> buffer) { |
| 714 DCHECK(decoder_); | 713 DCHECK(decoder_); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1106 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
| 1108 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1107 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 1109 gles2->DeleteTextures(1, &texture_id); | 1108 gles2->DeleteTextures(1, &texture_id); |
| 1110 } | 1109 } |
| 1111 | 1110 |
| 1112 void VideoDecoderShim::FlushCommandBuffer() { | 1111 void VideoDecoderShim::FlushCommandBuffer() { |
| 1113 context_provider_->ContextGL()->Flush(); | 1112 context_provider_->ContextGL()->Flush(); |
| 1114 } | 1113 } |
| 1115 | 1114 |
| 1116 } // namespace content | 1115 } // namespace content |
| OLD | NEW |