| 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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   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( | 
|   872     media::VideoCodecProfile profile, |   872     const media::VideoDecodeAcelerator::InitParams& params, | 
|   873     media::VideoDecodeAccelerator::Client* client) { |   873     media::VideoDecodeAccelerator::Client* client) { | 
|   874   DCHECK_EQ(client, host_); |   874   DCHECK_EQ(client, host_); | 
|   875   DCHECK(RenderThreadImpl::current()); |   875   DCHECK(RenderThreadImpl::current()); | 
|   876   DCHECK_EQ(state_, UNINITIALIZED); |   876   DCHECK_EQ(state_, UNINITIALIZED); | 
|   877   media::VideoCodec codec = media::kUnknownVideoCodec; |   877   media::VideoCodec codec = media::kUnknownVideoCodec; | 
|   878   if (profile <= media::H264PROFILE_MAX) |   878   if (params.profile <= media::H264PROFILE_MAX) | 
|   879     codec = media::kCodecH264; |   879     codec = media::kCodecH264; | 
|   880   else if (profile <= media::VP8PROFILE_MAX) |   880   else if (params.profile <= media::VP8PROFILE_MAX) | 
|   881     codec = media::kCodecVP8; |   881     codec = media::kCodecVP8; | 
|   882   else if (profile <= media::VP9PROFILE_MAX) |   882   else if (params.profile <= media::VP9PROFILE_MAX) | 
|   883     codec = media::kCodecVP9; |   883     codec = media::kCodecVP9; | 
|   884   DCHECK_NE(codec, media::kUnknownVideoCodec); |   884   DCHECK_NE(codec, media::kUnknownVideoCodec); | 
|   885  |   885  | 
|   886   if (!IsCodecSupported(codec)) |   886   if (!IsCodecSupported(codec)) | 
|   887     return false; |   887     return false; | 
|   888  |   888  | 
|   889   if (!yuv_converter_->Initialize()) |   889   if (!yuv_converter_->Initialize()) | 
|   890     return false; |   890     return false; | 
|   891  |   891  | 
|   892   media::VideoDecoderConfig config( |   892   media::VideoDecoderConfig config( | 
|   893       codec, profile, media::PIXEL_FORMAT_YV12, media::COLOR_SPACE_UNSPECIFIED, |   893       codec, params.profile, media::PIXEL_FORMAT_YV12, | 
 |   894       media::COLOR_SPACE_UNSPECIFIED, | 
|   894       gfx::Size(32, 24),  // Small sizes that won't fail. |   895       gfx::Size(32, 24),  // Small sizes that won't fail. | 
|   895       gfx::Rect(32, 24), gfx::Size(32, 24), |   896       gfx::Rect(32, 24), gfx::Size(32, 24), | 
|   896       // TODO(bbudge): Verify extra data isn't needed. |   897       // TODO(bbudge): Verify extra data isn't needed. | 
|   897       media::EmptyExtraData(), false /* decryption */); |   898       media::EmptyExtraData(), false /* decryption */); | 
|   898  |   899  | 
|   899   media_task_runner_->PostTask( |   900   media_task_runner_->PostTask( | 
|   900       FROM_HERE, |   901       FROM_HERE, | 
|   901       base::Bind(&VideoDecoderShim::DecoderImpl::Initialize, |   902       base::Bind(&VideoDecoderShim::DecoderImpl::Initialize, | 
|   902                  base::Unretained(decoder_impl_.get()), |   903                  base::Unretained(decoder_impl_.get()), | 
|   903                  config)); |   904                  config)); | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1116 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |  1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 
|  1117   gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |  1118   gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 
|  1118   gles2->DeleteTextures(1, &texture_id); |  1119   gles2->DeleteTextures(1, &texture_id); | 
|  1119 } |  1120 } | 
|  1120  |  1121  | 
|  1121 void VideoDecoderShim::FlushCommandBuffer() { |  1122 void VideoDecoderShim::FlushCommandBuffer() { | 
|  1122   context_provider_->ContextGL()->Flush(); |  1123   context_provider_->ContextGL()->Flush(); | 
|  1123 } |  1124 } | 
|  1124  |  1125  | 
|  1125 }  // namespace content |  1126 }  // namespace content | 
| OLD | NEW |