[TTVD] Increase priority for video rendering crucial threads 96/325096/5
authorJakub Gajownik <j.gajownik2@samsung.com>
Mon, 19 May 2025 10:16:18 +0000 (12:16 +0200)
committerBot Blink <blinkbot@samsung.com>
Tue, 3 Jun 2025 08:58:24 +0000 (08:58 +0000)
During video playback there are several important threads
doing rather lightweight tasks needed to keep rendering
smooth. Stalling any of it might dramatically reduce
user experience. When video playback is on, priority
of Media and VideoFrameCompsitor is increased.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-680
Change-Id: I8d1fa67e2d4223d953cb76a7fbf76318621402dc
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
media/filters/tizen/BUILD.gn
media/filters/tizen/ttvd_video_renderer.cc

index 456153a4cac29fac39b21075218c6bb2751f0548..64d5b297cda9f33d5435b15d665e54fb9f225413 100644 (file)
@@ -68,6 +68,10 @@ source_set("ttvd_renderer") {
   ]
 
   deps = [ "//media/mojo/clients" ]
+
+  if (tizen_thread_booster_service) {
+    deps += [ "//tizen_src/chromium_impl/services/thread_booster/public/cpp" ]
+  }
 }
 
 source_set("ttvd") {
index 155c44b2079a1a6d07b688da6eca815b2b6a4183..504b04b171337813c38719c70355c2c2a67b5106 100644 (file)
 #include "media/base/video_frame.h"
 #include "media/filters/tizen/ttvd_video_decoder.h"
 
+#if defined(THREAD_BOOSTER_SERVICE)
+#include "services/thread_booster/public/cpp/thread_booster.h"
+#endif  // defined(THREAD_BOOSTER_SERVICE)
+
 namespace media {
 
 namespace {
@@ -599,6 +603,17 @@ void TTvdVideoRenderer::OnTimeProgressing() {
   }
 
   time_progressing_ = true;
+
+#if defined(THREAD_BOOSTER_SERVICE)
+  // Increase priority, but only for threads that are crucial for playback
+  // stability. We need to keep the restricted for the effect to be visible.
+  thread_booster::BoostThreadByName("VideoFrameCompositor",
+                                    thread_booster::MediaType::kVideo,
+                                    thread_booster::BoostingLevel::kRealtime);
+  thread_booster::BoostThreadByName("Media", thread_booster::MediaType::kVideo,
+                                    thread_booster::BoostingLevel::kRealtime);
+#endif
+
   if (video_resource_strategy_ ==
           VideoResourceStrategy::kHardwareOnlyAndPause &&
       video_resource_helper_) {