[GStreamer][WPE] Use WPE_SHELL_MEDIA_DISK_CACHE_PATH env var to customize media disk cache path
https://bugs.webkit.org/show_bug.cgi?id=233477
Reviewed by Xabier Rodriguez-Calvar.
"/var/tmp" isn't always the best place to store the media download cache generated by GstDownloadBuffer
on embedded platforms. Each of those downloads can hold up to a whole movie (Gigabytes) and "/var/tmp"
is sometimes a memory based tmpfs. Some way to control the cache path is needed.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Honor environment variable.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@286166 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index fa68ba3..0fdb525 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2021-11-25 Enrique Ocaña González <eocanha@igalia.com>
+
+ [GStreamer][WPE] Use WPE_SHELL_MEDIA_DISK_CACHE_PATH env var to customize media disk cache path
+ https://bugs.webkit.org/show_bug.cgi?id=233477
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ "/var/tmp" isn't always the best place to store the media download cache generated by GstDownloadBuffer
+ on embedded platforms. Each of those downloads can hold up to a whole movie (Gigabytes) and "/var/tmp"
+ is sometimes a memory based tmpfs. Some way to control the cache path is needed.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Honor environment variable.
+
2021-11-25 Said Abou-Hallawa <said@apple.com>
[GPU Process] Make FilterEffect appliers take FilterImages in their apply() methods
diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index e1a21a2..9112659 100644
--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -2154,7 +2154,17 @@
GUniqueOutPtr<char> oldDownloadTemplate;
g_object_get(element, "temp-template", &oldDownloadTemplate.outPtr(), nullptr);
- GUniquePtr<char> newDownloadTemplate(g_build_filename(G_DIR_SEPARATOR_S, "var", "tmp", "WebKit-Media-XXXXXX", nullptr));
+#if PLATFORM(WPE)
+ GUniquePtr<char> mediaDiskCachePath(g_strdup(std::getenv("WPE_SHELL_MEDIA_DISK_CACHE_PATH")));
+ if (!mediaDiskCachePath || !*mediaDiskCachePath) {
+ GUniquePtr<char> defaultValue(g_build_filename(G_DIR_SEPARATOR_S, "var", "tmp", nullptr));
+ mediaDiskCachePath.swap(defaultValue);
+ }
+#else
+ GUniquePtr<char> mediaDiskCachePath(g_build_filename(G_DIR_SEPARATOR_S, "var", "tmp", nullptr));
+#endif
+
+ GUniquePtr<char> newDownloadTemplate(g_build_filename(G_DIR_SEPARATOR_S, mediaDiskCachePath.get(), "WebKit-Media-XXXXXX", nullptr));
g_object_set(element, "temp-template", newDownloadTemplate.get(), nullptr);
GST_DEBUG_OBJECT(pipeline(), "Reconfigured file download template from '%s' to '%s'", oldDownloadTemplate.get(), newDownloadTemplate.get());