| 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 |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 // No more callbacks from the delegate will be received now. | 861 // No more callbacks from the delegate will be received now. |
| 862 | 862 |
| 863 // The callback now holds the only reference to the DecoderImpl, which will be | 863 // The callback now holds the only reference to the DecoderImpl, which will be |
| 864 // deleted when Stop completes. | 864 // deleted when Stop completes. |
| 865 media_task_runner_->PostTask( | 865 media_task_runner_->PostTask( |
| 866 FROM_HERE, | 866 FROM_HERE, |
| 867 base::Bind(&VideoDecoderShim::DecoderImpl::Stop, | 867 base::Bind(&VideoDecoderShim::DecoderImpl::Stop, |
| 868 base::Owned(decoder_impl_.release()))); | 868 base::Owned(decoder_impl_.release()))); |
| 869 } | 869 } |
| 870 | 870 |
| 871 bool VideoDecoderShim::Initialize( | 871 bool VideoDecoderShim::Initialize(const StreamParameters& params, |
| 872 media::VideoCodecProfile profile, | 872 Client* client) { |
| 873 media::VideoDecodeAccelerator::Client* client) { | |
| 874 DCHECK_EQ(client, host_); | 873 DCHECK_EQ(client, host_); |
| 875 DCHECK(RenderThreadImpl::current()); | 874 DCHECK(RenderThreadImpl::current()); |
| 876 DCHECK_EQ(state_, UNINITIALIZED); | 875 DCHECK_EQ(state_, UNINITIALIZED); |
| 876 |
| 877 if (params.is_encrypted) { |
| 878 DLOG(ERROR) << "Encrypted streams are not supported for this VDA"; |
| 879 return false; |
| 880 } |
| 881 |
| 877 media::VideoCodec codec = media::kUnknownVideoCodec; | 882 media::VideoCodec codec = media::kUnknownVideoCodec; |
| 878 if (profile <= media::H264PROFILE_MAX) | 883 if (params.profile <= media::H264PROFILE_MAX) |
| 879 codec = media::kCodecH264; | 884 codec = media::kCodecH264; |
| 880 else if (profile <= media::VP8PROFILE_MAX) | 885 else if (params.profile <= media::VP8PROFILE_MAX) |
| 881 codec = media::kCodecVP8; | 886 codec = media::kCodecVP8; |
| 882 else if (profile <= media::VP9PROFILE_MAX) | 887 else if (params.profile <= media::VP9PROFILE_MAX) |
| 883 codec = media::kCodecVP9; | 888 codec = media::kCodecVP9; |
| 884 DCHECK_NE(codec, media::kUnknownVideoCodec); | 889 DCHECK_NE(codec, media::kUnknownVideoCodec); |
| 885 | 890 |
| 886 if (!IsCodecSupported(codec)) | 891 if (!IsCodecSupported(codec)) |
| 887 return false; | 892 return false; |
| 888 | 893 |
| 889 if (!yuv_converter_->Initialize()) | 894 if (!yuv_converter_->Initialize()) |
| 890 return false; | 895 return false; |
| 891 | 896 |
| 892 media::VideoDecoderConfig config( | 897 media::VideoDecoderConfig config( |
| 893 codec, profile, media::PIXEL_FORMAT_YV12, media::COLOR_SPACE_UNSPECIFIED, | 898 codec, params.profile, media::PIXEL_FORMAT_YV12, |
| 899 media::COLOR_SPACE_UNSPECIFIED, |
| 894 gfx::Size(32, 24), // Small sizes that won't fail. | 900 gfx::Size(32, 24), // Small sizes that won't fail. |
| 895 gfx::Rect(32, 24), gfx::Size(32, 24), | 901 gfx::Rect(32, 24), gfx::Size(32, 24), |
| 896 // TODO(bbudge): Verify extra data isn't needed. | 902 // TODO(bbudge): Verify extra data isn't needed. |
| 897 media::EmptyExtraData(), false /* decryption */); | 903 media::EmptyExtraData(), false /* decryption */); |
| 898 | 904 |
| 899 media_task_runner_->PostTask( | 905 media_task_runner_->PostTask( |
| 900 FROM_HERE, | 906 FROM_HERE, |
| 901 base::Bind(&VideoDecoderShim::DecoderImpl::Initialize, | 907 base::Bind(&VideoDecoderShim::DecoderImpl::Initialize, |
| 902 base::Unretained(decoder_impl_.get()), | 908 base::Unretained(decoder_impl_.get()), |
| 903 config)); | 909 config)); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1122 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
| 1117 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1123 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 1118 gles2->DeleteTextures(1, &texture_id); | 1124 gles2->DeleteTextures(1, &texture_id); |
| 1119 } | 1125 } |
| 1120 | 1126 |
| 1121 void VideoDecoderShim::FlushCommandBuffer() { | 1127 void VideoDecoderShim::FlushCommandBuffer() { |
| 1122 context_provider_->ContextGL()->Flush(); | 1128 context_provider_->ContextGL()->Flush(); |
| 1123 } | 1129 } |
| 1124 | 1130 |
| 1125 } // namespace content | 1131 } // namespace content |
| OLD | NEW |