| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/renderers/video_overlay_factory.h" | 5 #include "media/renderers/video_overlay_factory.h" |
| 6 | 6 |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "gpu/GLES2/gl2extchromium.h" | 8 #include "gpu/GLES2/gl2extchromium.h" |
| 9 #include "gpu/command_buffer/client/gles2_interface.h" | 9 #include "gpu/command_buffer/client/gles2_interface.h" |
| 10 #include "gpu/command_buffer/common/mailbox.h" | 10 #include "gpu/command_buffer/common/mailbox.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 gpu::MailboxHolder holders[VideoFrame::kMaxPlanes] = {gpu::MailboxHolder( | 100 gpu::MailboxHolder holders[VideoFrame::kMaxPlanes] = {gpu::MailboxHolder( |
| 101 texture->mailbox_, texture->sync_token_, GL_TEXTURE_2D)}; | 101 texture->mailbox_, texture->sync_token_, GL_TEXTURE_2D)}; |
| 102 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures( | 102 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures( |
| 103 PIXEL_FORMAT_XRGB, holders, VideoFrame::ReleaseMailboxCB(), | 103 PIXEL_FORMAT_XRGB, holders, VideoFrame::ReleaseMailboxCB(), |
| 104 size, // coded_size | 104 size, // coded_size |
| 105 gfx::Rect(size), // visible rect | 105 gfx::Rect(size), // visible rect |
| 106 size, // natural size | 106 size, // natural size |
| 107 base::TimeDelta()); // timestamp | 107 base::TimeDelta()); // timestamp |
| 108 CHECK(frame); | 108 CHECK(frame); |
| 109 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); | 109 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); |
| 110 // TODO(halliwell): this is to block idle suspend behaviour on Chromecast. | |
| 111 // Find a better way to do this. | |
| 112 frame->metadata()->SetBoolean(VideoFrameMetadata::DECODER_OWNS_FRAME, true); | |
| 113 return frame; | 110 return frame; |
| 114 } | 111 } |
| 115 | 112 |
| 116 VideoOverlayFactory::Texture* VideoOverlayFactory::GetTexture() { | 113 VideoOverlayFactory::Texture* VideoOverlayFactory::GetTexture() { |
| 117 if (!gpu_factories_) | 114 if (!gpu_factories_) |
| 118 return nullptr; | 115 return nullptr; |
| 119 | 116 |
| 120 // Lazily create overlay texture. | 117 // Lazily create overlay texture. |
| 121 if (!texture_) | 118 if (!texture_) |
| 122 texture_.reset(new Texture(gpu_factories_)); | 119 texture_.reset(new Texture(gpu_factories_)); |
| 123 | 120 |
| 124 return texture_->IsValid() ? texture_.get() : nullptr; | 121 return texture_->IsValid() ? texture_.get() : nullptr; |
| 125 } | 122 } |
| 126 | 123 |
| 127 } // namespace media | 124 } // namespace media |
| OLD | NEW |