Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: content/renderer/media/android/stream_texture_factory_synchronous_impl.cc

Issue 1848923003: Revert of Make Android StreamTexture implement GLStreamTextureImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « content/renderer/media/android/stream_texture_factory_impl.cc ('k') | content/renderer/media/webmediaplayer_ms_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698