| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 decode_id_(0) { | 118 decode_id_(0) { |
| 119 } | 119 } |
| 120 | 120 |
| 121 VideoDecoderShim::DecoderImpl::~DecoderImpl() { | 121 VideoDecoderShim::DecoderImpl::~DecoderImpl() { |
| 122 DCHECK(pending_decodes_.empty()); | 122 DCHECK(pending_decodes_.empty()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void VideoDecoderShim::DecoderImpl::Initialize( | 125 void VideoDecoderShim::DecoderImpl::Initialize( |
| 126 media::VideoDecoderConfig config) { | 126 media::VideoDecoderConfig config) { |
| 127 DCHECK(!decoder_); | 127 DCHECK(!decoder_); |
| 128 #if !defined(MEDIA_DISABLE_LIBVPX) |
| 128 if (config.codec() == media::kCodecVP9) { | 129 if (config.codec() == media::kCodecVP9) { |
| 129 decoder_.reset( | 130 decoder_.reset( |
| 130 new media::VpxVideoDecoder(base::MessageLoopProxy::current())); | 131 new media::VpxVideoDecoder(base::MessageLoopProxy::current())); |
| 131 } else { | 132 } else |
| 133 #endif |
| 134 { |
| 132 scoped_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( | 135 scoped_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( |
| 133 new media::FFmpegVideoDecoder(base::MessageLoopProxy::current())); | 136 new media::FFmpegVideoDecoder(base::MessageLoopProxy::current())); |
| 134 ffmpeg_video_decoder->set_decode_nalus(true); | 137 ffmpeg_video_decoder->set_decode_nalus(true); |
| 135 decoder_ = ffmpeg_video_decoder.Pass(); | 138 decoder_ = ffmpeg_video_decoder.Pass(); |
| 136 } | 139 } |
| 137 max_decodes_at_decoder_ = decoder_->GetMaxDecodeRequests(); | 140 max_decodes_at_decoder_ = decoder_->GetMaxDecodeRequests(); |
| 138 // We can use base::Unretained() safely in decoder callbacks because | 141 // We can use base::Unretained() safely in decoder callbacks because |
| 139 // |decoder_| is owned by DecoderImpl. During Stop(), the |decoder_| will be | 142 // |decoder_| is owned by DecoderImpl. During Stop(), the |decoder_| will be |
| 140 // destroyed and all outstanding callbacks will be fired. | 143 // destroyed and all outstanding callbacks will be fired. |
| 141 decoder_->Initialize( | 144 decoder_->Initialize( |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 580 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
| 578 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 581 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 579 gles2->DeleteTextures(1, &texture_id); | 582 gles2->DeleteTextures(1, &texture_id); |
| 580 } | 583 } |
| 581 | 584 |
| 582 void VideoDecoderShim::FlushCommandBuffer() { | 585 void VideoDecoderShim::FlushCommandBuffer() { |
| 583 context_provider_->ContextGL()->Flush(); | 586 context_provider_->ContextGL()->Flush(); |
| 584 } | 587 } |
| 585 | 588 |
| 586 } // namespace content | 589 } // namespace content |
| OLD | NEW |