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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 DCHECK(pending_texture_mailboxes_.empty()); | 1035 DCHECK(pending_texture_mailboxes_.empty()); |
1036 for (uint32_t i = 0; i < texture_pool_size_; i++) | 1036 for (uint32_t i = 0; i < texture_pool_size_; i++) |
1037 pending_texture_mailboxes_.push_back(gpu::Mailbox::Generate()); | 1037 pending_texture_mailboxes_.push_back(gpu::Mailbox::Generate()); |
1038 | 1038 |
1039 host_->RequestTextures(texture_pool_size_, | 1039 host_->RequestTextures(texture_pool_size_, |
1040 frame->video_frame->coded_size(), GL_TEXTURE_2D, | 1040 frame->video_frame->coded_size(), GL_TEXTURE_2D, |
1041 pending_texture_mailboxes_); | 1041 pending_texture_mailboxes_); |
1042 texture_size_ = frame->video_frame->coded_size(); | 1042 texture_size_ = frame->video_frame->coded_size(); |
1043 } | 1043 } |
1044 | 1044 |
1045 pending_frames_.push(linked_ptr<PendingFrame>(frame.release())); | 1045 pending_frames_.push(std::move(frame)); |
1046 SendPictures(); | 1046 SendPictures(); |
1047 } | 1047 } |
1048 } | 1048 } |
1049 | 1049 |
1050 void VideoDecoderShim::SendPictures() { | 1050 void VideoDecoderShim::SendPictures() { |
1051 DCHECK(RenderThreadImpl::current()); | 1051 DCHECK(RenderThreadImpl::current()); |
1052 DCHECK(host_); | 1052 DCHECK(host_); |
1053 while (!pending_frames_.empty() && !available_textures_.empty()) { | 1053 while (!pending_frames_.empty() && !available_textures_.empty()) { |
1054 const linked_ptr<PendingFrame>& frame = pending_frames_.front(); | 1054 const scoped_ptr<PendingFrame>& frame = pending_frames_.front(); |
1055 | 1055 |
1056 TextureIdSet::iterator it = available_textures_.begin(); | 1056 TextureIdSet::iterator it = available_textures_.begin(); |
1057 uint32_t texture_id = *it; | 1057 uint32_t texture_id = *it; |
1058 available_textures_.erase(it); | 1058 available_textures_.erase(it); |
1059 | 1059 |
1060 uint32_t local_texture_id = texture_id_map_[texture_id]; | 1060 uint32_t local_texture_id = texture_id_map_[texture_id]; |
1061 | 1061 |
1062 yuv_converter_->Convert(frame->video_frame, local_texture_id); | 1062 yuv_converter_->Convert(frame->video_frame, local_texture_id); |
1063 | 1063 |
1064 host_->PictureReady(media::Picture(texture_id, frame->decode_id, | 1064 host_->PictureReady(media::Picture(texture_id, frame->decode_id, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1116 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
1117 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1117 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
1118 gles2->DeleteTextures(1, &texture_id); | 1118 gles2->DeleteTextures(1, &texture_id); |
1119 } | 1119 } |
1120 | 1120 |
1121 void VideoDecoderShim::FlushCommandBuffer() { | 1121 void VideoDecoderShim::FlushCommandBuffer() { |
1122 context_provider_->ContextGL()->Flush(); | 1122 context_provider_->ContextGL()->Flush(); |
1123 } | 1123 } |
1124 | 1124 |
1125 } // namespace content | 1125 } // namespace content |
OLD | NEW |