[GS] Allow dumping rtc video decoder data 92/315392/5
authorJakub Gajownik <j.gajownik2@samsung.com>
Thu, 25 Jul 2024 09:57:07 +0000 (11:57 +0200)
committerBot Blink <blinkbot@samsung.com>
Wed, 31 Jul 2024 08:49:42 +0000 (08:49 +0000)
This change allows enabling data dumping into file for
WebRTC stream. It's done based on the existance of
"/etc/tizen_webrtc_dump", its content is treated as
directory where webrtc stream dumps should be saved.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-542
Change-Id: Ia68e9e6d9ba2a679cb30f2f096d7a60acad28155
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc

index 984485a96d0ee19c60ab602eeac8d4a4ea0a0960..c9efe3830a6eef30f4c374ee02874f9c4c407875 100644 (file)
 #include "base/callback.h"
 #include "base/callback_helpers.h"
 #include "base/cpu.h"
+#include "base/files/file_util.h"
 #include "base/location.h"
 #include "base/logging.h"
+#include "base/metrics/field_trial.h"
 #include "base/metrics/histogram_functions.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/synchronization/waitable_event.h"
@@ -151,6 +153,20 @@ class ProxyAsyncResolverFactory final : public webrtc::AsyncResolverFactory {
 // "heavy-weight" and we don't want to create them per frame.
 class PeerConnectionStaticDeps {
  public:
+#if BUILDFLAG(IS_TIZEN_TV)
+  PeerConnectionStaticDeps() {
+    constexpr const char* kDumpConfigPath = "/etc/tizen_webrtc_dump";
+    std::string dump_directory;
+    if (!base::ReadFileToString(base::FilePath(kDumpConfigPath),
+                                &dump_directory)) {
+      return;
+    }
+
+    base::FieldTrialList::CreateFieldTrial("WebRTC-DecoderDataDumpDirectory",
+                                           dump_directory);
+  }
+#endif  // BUILDFLAG(IS_TIZEN_TV)
+
   enum class Type { kChromium, kWebRTC };
   virtual ~PeerConnectionStaticDeps() = default;