| Index: content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
|
| diff --git a/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc b/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
|
| index 513432a7e7c6b762be3ab6fbfe90e20da67440d5..86a0e378dfe6b53f2d9384020247bd18494e34b8 100644
|
| --- a/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
|
| +++ b/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
|
| @@ -54,13 +54,16 @@
|
| scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>
|
| context_provider_;
|
| scoped_refptr<gfx::SurfaceTexture> surface_texture_;
|
| + float current_matrix_[16];
|
| + bool has_updated_;
|
|
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureProxyImpl);
|
| };
|
|
|
| StreamTextureProxyImpl::StreamTextureProxyImpl(
|
| StreamTextureFactorySynchronousImpl::ContextProvider* provider)
|
| - : client_(NULL), context_provider_(provider) {
|
| + : client_(NULL), context_provider_(provider), has_updated_(false) {
|
| + std::fill(current_matrix_, current_matrix_ + 16, 0);
|
| }
|
|
|
| StreamTextureProxyImpl::~StreamTextureProxyImpl() {}
|
| @@ -119,6 +122,25 @@
|
| }
|
|
|
| void StreamTextureProxyImpl::OnFrameAvailable() {
|
| + // GetTransformMatrix only returns something valid after both is true:
|
| + // - OnFrameAvailable was called
|
| + // - we called UpdateTexImage
|
| + if (has_updated_) {
|
| + float matrix[16];
|
| + surface_texture_->GetTransformMatrix(matrix);
|
| +
|
| + if (memcmp(current_matrix_, matrix, sizeof(matrix)) != 0) {
|
| + memcpy(current_matrix_, matrix, sizeof(matrix));
|
| +
|
| + base::AutoLock lock(lock_);
|
| + if (client_)
|
| + client_->DidUpdateMatrix(current_matrix_);
|
| + }
|
| + }
|
| + // OnFrameAvailable being called a second time implies that we called
|
| + // updateTexImage since after we received the first frame.
|
| + has_updated_ = true;
|
| +
|
| base::AutoLock lock(lock_);
|
| if (client_)
|
| client_->DidReceiveFrame();
|
|
|