Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions shell/platform/tizen/external_texture_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ ExternalTextureGL::~ExternalTextureGL() {
glDeleteTextures(1, &state_->gl_texture);
}
state_.release();
if (texture_tbm_surface_) {
tbm_surface_internal_unref(texture_tbm_surface_);
texture_tbm_surface_ = NULL;
}
DestructionTbmSurface();
mutex_.unlock();
}

Expand All @@ -47,12 +44,12 @@ bool ExternalTextureGL::OnFrameAvailable(tbm_surface_h tbm_surface) {
return false;
}
if (texture_tbm_surface_) {
LoggerE("texture_tbm_surface_ does not destruction, discard");
LoggerD("texture_tbm_surface_ does not destruction, discard");
mutex_.unlock();
return false;
}
if (!tbm_surface_internal_is_valid(tbm_surface)) {
LoggerE("tbm_surface not valid, pass");
LoggerD("tbm_surface not valid, pass");
mutex_.unlock();
return false;
}
Expand All @@ -66,12 +63,13 @@ bool ExternalTextureGL::PopulateTextureWithIdentifier(
size_t width, size_t height, FlutterOpenGLTexture* opengl_texture) {
mutex_.lock();
if (!texture_tbm_surface_) {
LoggerE("texture_tbm_surface_ is NULL");
LoggerD("texture_tbm_surface_ is NULL");
mutex_.unlock();
return false;
}
if (!tbm_surface_internal_is_valid(texture_tbm_surface_)) {
LoggerE("tbm_surface not valid");
LoggerD("tbm_surface not valid");
DestructionTbmSurface();
mutex_.unlock();
return false;
}
Expand Down Expand Up @@ -122,20 +120,23 @@ bool ExternalTextureGL::PopulateTextureWithIdentifier(
return true;
}

void ExternalTextureGL::DestructionTbmSurface() {
void ExternalTextureGL::DestructionTbmSurfaceWithLock() {
mutex_.lock();
DestructionTbmSurface();
mutex_.unlock();
}

void ExternalTextureGL::DestructionTbmSurface() {
if (!texture_tbm_surface_) {
LoggerE("tbm_surface_h is NULL");
mutex_.unlock();
return;
}
tbm_surface_internal_unref(texture_tbm_surface_);
texture_tbm_surface_ = NULL;
mutex_.unlock();
}

void ExternalTextureGL::destructionCallback(void* user_data) {
ExternalTextureGL* externalTextureGL =
reinterpret_cast<ExternalTextureGL*>(user_data);
externalTextureGL->DestructionTbmSurface();
externalTextureGL->DestructionTbmSurfaceWithLock();
}
1 change: 1 addition & 0 deletions shell/platform/tizen/external_texture_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ExternalTextureGL {
FlutterOpenGLTexture* opengl_texture);
bool OnFrameAvailable(tbm_surface_h tbm_surface);
void DestructionTbmSurface();
void DestructionTbmSurfaceWithLock();

private:
std::unique_ptr<ExternalTextureGLState> state_;
Expand Down