[TTVD] Notify collection about mode change when stealing surface 01/317001/5
authorJakub Gajownik <j.gajownik2@samsung.com>
Mon, 26 Aug 2024 10:44:35 +0000 (12:44 +0200)
committerj.gajownik2 <j.gajownik2@samsung.com>
Mon, 2 Sep 2024 09:30:25 +0000 (11:30 +0200)
It's possible that output surface is taken from decoder
that's using it during overlay preparation. Such preparation
waits until surface is fully initialized and reaches
"overlay" mode. After stealing surface by other decoder,
it'll wait infinitely.

This change fixes such scenario by notifying previous
surface client (decoder) about "texture" mode, so it might
finish preparation process.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-558
Change-Id: I951d27a5fba8e033ba40aebc98f0d28364fa0176
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
tizen_src/chromium_impl/ui/ozone/platform/efl/output_surface_proxy.cc

index 1d59e23dfba8243c1ffd6b993c71517cddf1f821..49215c9b23a54a156ea07321499d3caacb76d2d5 100644 (file)
@@ -211,6 +211,15 @@ gfx::VideoOutputMode OutputSurfaceProxy::PrepareToRender(
   // When collection for preparation is changed we should reset result,
   // to avoid returning invalid value.
   if (collection_token_on_client_ != collection_token) {
+    TIZEN_MEDIA_LOG(VERBOSE) << "Collection token change from: "
+                             << collection_token_on_client_.ToString()
+                             << " to: " << collection_token.ToString();
+
+    // Notify previous collection about mode change. It might wait to reach
+    // overlay mode (like preparation during decoder start).
+    if (mode_cb_on_client_) {
+      mode_cb_on_client_.Run(gfx::VideoOutputMode::kTexture);
+    }
     collection_token_on_client_ = collection_token;
     last_result_on_client_ = gfx::VideoOutputMode::kTransitionUnmuting;
     is_first_preparation = true;
@@ -226,6 +235,12 @@ gfx::VideoOutputMode OutputSurfaceProxy::PrepareToRender(
   auto bound_mode_cb = media::BindToCurrentLoop(base::BindRepeating(
       &OutputSurfaceProxy::UpdateMode, client_accessor_->weak_ptr));
   if (!initialized_on_client_.has_value()) {
+    if (pending_prepare_to_render_on_client_ &&
+        pending_prepare_to_render_on_client_->mode_cb) {
+      TIZEN_MEDIA_LOG(VERBOSE) << "Notify old pending prepare of stealing";
+      pending_prepare_to_render_on_client_->mode_cb.Run(
+          gfx::VideoOutputMode::kTexture);
+    }
     TIZEN_MEDIA_LOG(VERBOSE) << "Set pending prepare to render";
     pending_prepare_to_render_on_client_ = {collection_token,
                                             can_render_texture, bound_mode_cb};