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