| 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/media/android/stream_texture_factory_impl.h" | 5 #include "content/renderer/media/android/stream_texture_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "cc/output/context_provider.h" | 8 #include "cc/output/context_provider.h" |
| 9 #include "content/common/gpu/client/context_provider_command_buffer.h" | 9 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 10 #include "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 ~StreamTextureProxyImpl() override; | 24 ~StreamTextureProxyImpl() override; |
| 25 | 25 |
| 26 // StreamTextureProxy implementation: | 26 // StreamTextureProxy implementation: |
| 27 void BindToLoop(int32_t stream_id, | 27 void BindToLoop(int32_t stream_id, |
| 28 cc::VideoFrameProvider::Client* client, | 28 cc::VideoFrameProvider::Client* client, |
| 29 scoped_refptr<base::SingleThreadTaskRunner> loop) override; | 29 scoped_refptr<base::SingleThreadTaskRunner> loop) override; |
| 30 void Release() override; | 30 void Release() override; |
| 31 | 31 |
| 32 // StreamTextureHost::Listener implementation: | 32 // StreamTextureHost::Listener implementation: |
| 33 void OnFrameAvailable() override; | 33 void OnFrameAvailable() override; |
| 34 void OnMatrixChanged(const float matrix[16]) override; | |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 void BindOnThread(int32_t stream_id); | 36 void BindOnThread(int32_t stream_id); |
| 38 | 37 |
| 39 const scoped_ptr<StreamTextureHost> host_; | 38 const scoped_ptr<StreamTextureHost> host_; |
| 40 | 39 |
| 41 // Protects access to |client_| and |loop_|. | 40 // Protects access to |client_| and |loop_|. |
| 42 base::Lock lock_; | 41 base::Lock lock_; |
| 43 cc::VideoFrameProvider::Client* client_; | 42 cc::VideoFrameProvider::Client* client_; |
| 44 scoped_refptr<base::SingleThreadTaskRunner> loop_; | 43 scoped_refptr<base::SingleThreadTaskRunner> loop_; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void StreamTextureProxyImpl::BindOnThread(int32_t stream_id) { | 94 void StreamTextureProxyImpl::BindOnThread(int32_t stream_id) { |
| 96 host_->BindToCurrentThread(stream_id, this); | 95 host_->BindToCurrentThread(stream_id, this); |
| 97 } | 96 } |
| 98 | 97 |
| 99 void StreamTextureProxyImpl::OnFrameAvailable() { | 98 void StreamTextureProxyImpl::OnFrameAvailable() { |
| 100 base::AutoLock lock(lock_); | 99 base::AutoLock lock(lock_); |
| 101 if (client_) | 100 if (client_) |
| 102 client_->DidReceiveFrame(); | 101 client_->DidReceiveFrame(); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void StreamTextureProxyImpl::OnMatrixChanged(const float matrix[16]) { | |
| 106 base::AutoLock lock(lock_); | |
| 107 if (client_) | |
| 108 client_->DidUpdateMatrix(matrix); | |
| 109 } | |
| 110 | |
| 111 } // namespace | 104 } // namespace |
| 112 | 105 |
| 113 // static | 106 // static |
| 114 scoped_refptr<StreamTextureFactoryImpl> StreamTextureFactoryImpl::Create( | 107 scoped_refptr<StreamTextureFactoryImpl> StreamTextureFactoryImpl::Create( |
| 115 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 108 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 116 GpuChannelHost* channel) { | 109 GpuChannelHost* channel) { |
| 117 return new StreamTextureFactoryImpl(context_provider, channel); | 110 return new StreamTextureFactoryImpl(context_provider, channel); |
| 118 } | 111 } |
| 119 | 112 |
| 120 StreamTextureFactoryImpl::StreamTextureFactoryImpl( | 113 StreamTextureFactoryImpl::StreamTextureFactoryImpl( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 160 |
| 168 void StreamTextureFactoryImpl::AddObserver( | 161 void StreamTextureFactoryImpl::AddObserver( |
| 169 StreamTextureFactoryContextObserver* obs) { | 162 StreamTextureFactoryContextObserver* obs) { |
| 170 } | 163 } |
| 171 | 164 |
| 172 void StreamTextureFactoryImpl::RemoveObserver( | 165 void StreamTextureFactoryImpl::RemoveObserver( |
| 173 StreamTextureFactoryContextObserver* obs) { | 166 StreamTextureFactoryContextObserver* obs) { |
| 174 } | 167 } |
| 175 | 168 |
| 176 } // namespace content | 169 } // namespace content |
| OLD | NEW |