Skip to content

Commit

Permalink
Port more patches from Embedlite 31
Browse files Browse the repository at this point in the history
  • Loading branch information
rainemak committed Oct 26, 2015
1 parent 3fab452 commit da61a9a
Show file tree
Hide file tree
Showing 12 changed files with 518 additions and 15 deletions.
8 changes: 5 additions & 3 deletions rpm/0001-Configure-system-sqlite-to-use-jemalloc.patch
@@ -1,9 +1,11 @@
From 46b9ab1170c9a34ab2208c1a9fd8b44ebc5922a1 Mon Sep 17 00:00:00 2001
From bf75995e539b769481b3f27242b3790419522674 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Mon, 12 Oct 2015 16:18:14 +0300
Subject: [PATCH 1/4] Configure system sqlite to use jemalloc
Subject: [PATCH 01/11] Configure system sqlite to use jemalloc

See bug 25229
See bug JB25229

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
embedding/embedlite/EmbedLiteApp.cpp | 66 ++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
Expand Down
30 changes: 30 additions & 0 deletions rpm/0002-Workaround-for-bug-977015.patch
@@ -0,0 +1,30 @@
From 9239fe80dc786ec0259e134bf2fa98c18b18c79c Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
Date: Mon, 11 May 2015 13:01:34 +0300
Subject: [PATCH 02/11] Workaround for bug 977015

See bug JB16252

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
layout/generic/nsGfxScrollFrame.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index e6c3bb6..b111eff 100644
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1096,8 +1096,8 @@ ScrollFrameHelper::WantAsyncScroll() const
// The check for scroll bars was added in bug 825692 to prevent layerization
// of text inputs for performance reasons. However, if a text input is
// focused we want to layerize it so we can async scroll it (bug 946408).
- bool isVAsyncScrollable = isVScrollable && (mVScrollbarBox || isFocused);
- bool isHAsyncScrollable = isHScrollable && (mHScrollbarBox || isFocused);
+ bool isVAsyncScrollable = isVScrollable;
+ bool isHAsyncScrollable = isHScrollable;
return isVAsyncScrollable || isHAsyncScrollable;
}

--
2.1.4

29 changes: 29 additions & 0 deletions rpm/0003-Workaround-wrong-viewport-in-wikipedia.patch
@@ -0,0 +1,29 @@
From b898ddef0a6b7e3149e8a2f7f0f0d92a7e232822 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
Date: Mon, 11 May 2015 13:03:43 +0300
Subject: [PATCH 03/11] Workaround wrong viewport in wikipedia

See bug JB11251

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
gfx/layers/apz/src/AsyncPanZoomController.cpp | 3 +++
1 file changed, 3 insertions(+)

diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp
index 6c45588..cffad74 100644
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -2691,6 +2691,9 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
mFrameMetrics.GetViewport().height != aLayerMetrics.GetViewport().height) {
needContentRepaint = true;
viewportUpdated = true;
+ if (mFrameMetrics.GetViewport().width != aLayerMetrics.GetViewport().width) {
+ mFrameMetrics.SetZoom(aLayerMetrics.GetZoom());
+ }
}
mFrameMetrics.SetViewport(aLayerMetrics.GetViewport());
}
--
2.1.4

272 changes: 272 additions & 0 deletions rpm/0004-Supply-source-uri-to-gstreamer-pipeline.patch
@@ -0,0 +1,272 @@
From 226120e9273adf782fe94c06aeff188b46cf0dad Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
Date: Mon, 11 May 2015 13:10:46 +0300
Subject: [PATCH 04/11] Supply source uri to gstreamer pipeline

See bug JB19511

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
dom/media/gstreamer/GStreamerFormatHelper.cpp | 11 ++++-
dom/media/gstreamer/GStreamerFunctionList.h | 8 +++
dom/media/gstreamer/GStreamerLoader.cpp | 6 ++-
dom/media/gstreamer/GStreamerReader.cpp | 57 ++++++++++++++++++++++
dom/media/gstreamer/GStreamerReader.h | 11 +++++
netwerk/mime/nsMimeTypes.h | 1 +
toolkit/components/mediasniffer/nsMediaSniffer.cpp | 4 +-
7 files changed, 93 insertions(+), 5 deletions(-)

diff --git a/dom/media/gstreamer/GStreamerFormatHelper.cpp b/dom/media/gstreamer/GStreamerFormatHelper.cpp
index ebd12c2..a4b82ba 100644
--- a/dom/media/gstreamer/GStreamerFormatHelper.cpp
+++ b/dom/media/gstreamer/GStreamerFormatHelper.cpp
@@ -35,13 +35,17 @@ void GStreamerFormatHelper::Shutdown() {
gInstance = nullptr;
}

-static char const *const sContainers[6][2] = {
+static char const *const sContainers[10][2] = {
{"video/mp4", "video/quicktime"},
{"video/quicktime", "video/quicktime"},
{"audio/mp4", "audio/x-m4a"},
{"audio/x-m4a", "audio/x-m4a"},
{"audio/mpeg", "audio/mpeg, mpegversion=(int)1"},
{"audio/mp3", "audio/mpeg, mpegversion=(int)1"},
+ {"audio/x-mpegurl", "application/x-hls"},
+ {"application/x-mpegurl", "application/x-hls"},
+ {"application/vnd.apple.mpegurl", "application/x-hls"},
+ {"video/mpegts", "video/mpegts"}
};

static char const *const sCodecs[9][2] = {
@@ -62,7 +66,10 @@ static char const * const sDefaultCodecCaps[][2] = {
{"audio/mp4", "audio/mpeg, mpegversion=(int)4"},
{"audio/x-m4a", "audio/mpeg, mpegversion=(int)4"},
{"audio/mp3", "audio/mpeg, layer=(int)3"},
- {"audio/mpeg", "audio/mpeg, layer=(int)3"}
+ {"audio/mpeg", "audio/mpeg, layer=(int)3"},
+ {"audio/x-mpegurl", "video/x-h264"},
+ {"application/x-mpegurl", "video/x-h264"},
+ {"application/vnd.apple.mpegurl", "video/x-h264"},
};

static char const * const sPluginBlacklist[] = {
diff --git a/dom/media/gstreamer/GStreamerFunctionList.h b/dom/media/gstreamer/GStreamerFunctionList.h
index ebdeeb6..4b77e15 100644
--- a/dom/media/gstreamer/GStreamerFunctionList.h
+++ b/dom/media/gstreamer/GStreamerFunctionList.h
@@ -18,6 +18,7 @@ GST_FUNC(LIBGSTAPP, gst_app_src_set_callbacks)
GST_FUNC(LIBGSTAPP, gst_app_src_set_caps)
GST_FUNC(LIBGSTAPP, gst_app_src_set_size)
GST_FUNC(LIBGSTAPP, gst_app_src_set_stream_type)
+GST_FUNC(LIBGSTBASE, gst_base_src_get_type)
GST_FUNC(LIBGSTREAMER, gst_bin_get_by_name)
GST_FUNC(LIBGSTREAMER, gst_bin_get_type)
GST_FUNC(LIBGSTREAMER, gst_bin_iterate_recurse)
@@ -57,11 +58,13 @@ GST_FUNC(LIBGSTREAMER, gst_object_get_name)
GST_FUNC(LIBGSTREAMER, gst_object_get_parent)
GST_FUNC(LIBGSTREAMER, gst_object_unref)
GST_FUNC(LIBGSTREAMER, gst_pad_get_element_private)
+GST_FUNC(LIBGSTREAMER, gst_pad_query_default)
GST_FUNC(LIBGSTREAMER, gst_pad_set_element_private)
GST_FUNC(LIBGSTREAMER, gst_parse_bin_from_description)
GST_FUNC(LIBGSTREAMER, gst_pipeline_get_bus)
GST_FUNC(LIBGSTREAMER, gst_pipeline_get_type)
GST_FUNC(LIBGSTREAMER, gst_plugin_feature_get_rank)
+GST_FUNC(LIBGSTREAMER, gst_query_set_uri)
GST_FUNC(LIBGSTREAMER, gst_plugin_feature_get_type)
GST_FUNC(LIBGSTREAMER, gst_registry_feature_filter)
GST_FUNC(LIBGSTREAMER, gst_registry_get_feature_list_cookie)
@@ -73,6 +76,9 @@ GST_FUNC(LIBGSTREAMER, gst_structure_get_fraction)
GST_FUNC(LIBGSTREAMER, gst_structure_get_int)
GST_FUNC(LIBGSTREAMER, gst_structure_get_value)
GST_FUNC(LIBGSTREAMER, gst_structure_new)
+GST_FUNC(LIBGSTREAMER, gst_uri_handler_get_type)
+GST_FUNC(LIBGSTREAMER, gst_uri_handler_get_uri)
+GST_FUNC(LIBGSTREAMER, gst_uri_handler_set_uri)
GST_FUNC(LIBGSTREAMER, gst_util_uint64_scale)

#if GST_VERSION_MAJOR == 0
@@ -89,6 +95,7 @@ GST_FUNC(LIBGSTREAMER, gst_pad_add_event_probe)
GST_FUNC(LIBGSTREAMER, gst_pad_alloc_buffer)
GST_FUNC(LIBGSTREAMER, gst_pad_get_negotiated_caps)
GST_FUNC(LIBGSTREAMER, gst_pad_set_bufferalloc_function)
+GST_FUNC(LIBGSTREAMER, gst_pad_set_query_function)
GST_FUNC(LIBGSTREAMER, gst_plugin_feature_get_name)
GST_FUNC(LIBGSTREAMER, gst_registry_get_default)
GST_FUNC(LIBGSTREAMER, gst_segment_set_newsegment)
@@ -132,6 +139,7 @@ GST_FUNC(LIBGSTREAMER, gst_object_get_type)
GST_FUNC(LIBGSTREAMER, gst_pad_add_probe)
GST_FUNC(LIBGSTREAMER, gst_pad_get_current_caps)
GST_FUNC(LIBGSTREAMER, gst_pad_probe_info_get_query)
+GST_FUNC(LIBGSTREAMER, gst_pad_set_query_function_full)
GST_FUNC(LIBGSTREAMER, gst_query_add_allocation_meta)
GST_FUNC(LIBGSTREAMER, gst_query_add_allocation_param)
GST_FUNC(LIBGSTREAMER, gst_query_add_allocation_pool)
diff --git a/dom/media/gstreamer/GStreamerLoader.cpp b/dom/media/gstreamer/GStreamerLoader.cpp
index 8182f68..796a993 100644
--- a/dom/media/gstreamer/GStreamerLoader.cpp
+++ b/dom/media/gstreamer/GStreamerLoader.cpp
@@ -13,6 +13,7 @@
#define LIBGSTREAMER 0
#define LIBGSTAPP 1
#define LIBGSTVIDEO 2
+#define LIBGSTBASE 3

#ifdef __OpenBSD__
#define LIB_GST_SUFFIX ".so"
@@ -73,10 +74,11 @@ load_gstreamer()
gstreamerLib = dlopen("libgstreamer-" GST_API_VERSION LIB_GST_SUFFIX, RTLD_NOW | RTLD_LOCAL);
}

- void *handles[3] = {
+ void *handles[4] = {
gstreamerLib,
dlopen("libgstapp-" GST_API_VERSION LIB_GST_SUFFIX, RTLD_NOW | RTLD_LOCAL),
- dlopen("libgstvideo-" GST_API_VERSION LIB_GST_SUFFIX, RTLD_NOW | RTLD_LOCAL)
+ dlopen("libgstvideo-" GST_API_VERSION LIB_GST_SUFFIX, RTLD_NOW | RTLD_LOCAL),
+ dlopen("libgstbase-" GST_API_VERSION LIB_GST_SUFFIX, RTLD_NOW | RTLD_LOCAL)
};

for (size_t i = 0; i < sizeof(handles) / sizeof(handles[0]); i++) {
diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp
index 3c92e53..c07fa15 100644
--- a/dom/media/gstreamer/GStreamerReader.cpp
+++ b/dom/media/gstreamer/GStreamerReader.cpp
@@ -135,6 +135,11 @@ GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)

gst_segment_init(&mVideoSegment, GST_FORMAT_UNDEFINED);
gst_segment_init(&mAudioSegment, GST_FORMAT_UNDEFINED);
+
+ nsIURI *uri = aDecoder->GetResource()->URI();
+ if (uri) {
+ uri->GetAsciiSpec(mUri);
+ }
}

GStreamerReader::~GStreamerReader()
@@ -308,6 +313,51 @@ void GStreamerReader::PlayBinSourceSetupCb(GstElement* aPlayBin,
g_object_get(aPlayBin, "source", &source, nullptr);
reader->PlayBinSourceSetup(GST_APP_SRC(source));
}
+#if GST_VERSION_MAJOR == 1
+gboolean GStreamerReader::AppSrcQueryCB(GstPad *pad, GstObject *parent, GstQuery *query)
+{
+ GstBaseSrc *src = GST_BASE_SRC(parent);
+#else
+gboolean GStreamerReader::AppSrcQueryCB(GstPad *pad, GstQuery *query)
+{
+ GstBaseSrc *src = GST_BASE_SRC(gst_pad_get_parent(pad));
+#endif
+ gboolean result;
+
+ if (!src)
+ return FALSE;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_URI: {
+ GStreamerReader *reader = static_cast<GStreamerReader *>(gst_pad_get_element_private(pad));
+
+ const char *uri;
+ if (NS_CStringGetData(reader->mUri, &uri) > 0) {
+ gst_query_set_uri(query, uri);
+ result = TRUE;
+ } else {
+ result = FALSE;
+ }
+ break;
+ }
+ default: {
+ GstBaseSrcClass *bclass = GST_BASE_SRC_GET_CLASS(src);
+ if (bclass->query)
+ result = bclass->query(src, query);
+ else
+#if GST_VERSION_MAJOR == 1
+ result = gst_pad_query_default(pad, parent, query);
+#else
+ result = gst_pad_query_default(pad, query);
+#endif
+ }
+ }
+
+#if GST_VERSION_MAJOR == 0
+ gst_object_unref(src);
+#endif
+ return result;
+}

void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
{
@@ -340,6 +390,13 @@ void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
gst_app_src_set_stream_type(mSource, GST_APP_STREAM_TYPE_SEEKABLE);
}

+ GstPad *srcPad = gst_element_get_static_pad(GST_ELEMENT(mSource), "src");
+ if (srcPad) {
+ gst_pad_set_element_private(srcPad, this);
+ gst_pad_set_query_function(srcPad, AppSrcQueryCB);
+ gst_object_unref (srcPad);
+ }
+
// Set the source MIME type to stop typefind trying every. single. format.
GstCaps *caps =
GStreamerFormatHelper::ConvertFormatsToCaps(mDecoder->GetResource()->GetContentType().get(),
diff --git a/dom/media/gstreamer/GStreamerReader.h b/dom/media/gstreamer/GStreamerReader.h
index d455954..8746198c 100644
--- a/dom/media/gstreamer/GStreamerReader.h
+++ b/dom/media/gstreamer/GStreamerReader.h
@@ -118,6 +118,15 @@ private:
GstCaps *aCaps,
GValueArray *aFactories);

+ /* Called to query information about source. Used to provide URI to
+ * upstream elements.
+ */
+#if GST_VERSION_MAJOR == 1
+ static gboolean AppSrcQueryCB(GstPad *pad, GstObject *parent, GstQuery *query);
+#else
+ static gboolean AppSrcQueryCB(GstPad *pad, GstQuery *query);
+#endif
+
/* Called on the source-setup signal emitted by playbin. Used to
* configure appsrc .
*/
@@ -266,6 +275,8 @@ private:
#endif
int fpsNum;
int fpsDen;
+
+ nsAutoCString mUri;
};

} // namespace mozilla
diff --git a/netwerk/mime/nsMimeTypes.h b/netwerk/mime/nsMimeTypes.h
index 447148c..0057cff 100644
--- a/netwerk/mime/nsMimeTypes.h
+++ b/netwerk/mime/nsMimeTypes.h
@@ -152,6 +152,7 @@
#define VIDEO_MPEG_TS "video/mp2t"
#define VIDEO_AVI "video/avi"
#define VIDEO_MATROSKA "video/x-matroska"
+#define VIDEO_M3U8 "application/vnd.apple.mpegurl"
#define APPLICATION_OGG "application/ogg"

/* x-uuencode-apple-single. QuickMail made me do this. */
diff --git a/toolkit/components/mediasniffer/nsMediaSniffer.cpp b/toolkit/components/mediasniffer/nsMediaSniffer.cpp
index fc45831..25818c2 100644
--- a/toolkit/components/mediasniffer/nsMediaSniffer.cpp
+++ b/toolkit/components/mediasniffer/nsMediaSniffer.cpp
@@ -35,7 +35,9 @@ nsMediaSniffer::nsMediaSnifferEntry nsMediaSniffer::sSnifferEntries[] = {
// The string RIFF, followed by four bytes, followed by the string WAVE
PATTERN_ENTRY("\xFF\xFF\xFF\xFF\x00\x00\x00\x00\xFF\xFF\xFF\xFF", "RIFF\x00\x00\x00\x00WAVE", AUDIO_WAV),
// mp3 with ID3 tags, the string "ID3".
- PATTERN_ENTRY("\xFF\xFF\xFF", "ID3", AUDIO_MP3)
+ PATTERN_ENTRY("\xFF\xFF\xFF", "ID3", AUDIO_MP3),
+ // live stream m3u playlist, the string ""#EXTM3U"
+ PATTERN_ENTRY("\xFF\xFF\xFF\xFF\xFF\xFF\xFF", "#EXTM3U", VIDEO_M3U8)
};

static bool MatchesMP4orISOBrand(const uint8_t aData[4])
--
2.1.4

29 changes: 29 additions & 0 deletions rpm/0005-Workaround-for-late-access-message-loop.patch
@@ -0,0 +1,29 @@
From 43b8eb70d0eaae85c83d52ebbcb246286264815a Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
Date: Mon, 11 May 2015 13:12:04 +0300
Subject: [PATCH 05/11] Workaround for late access message loop.

See bug JB10381

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
ipc/glue/MessagePump.cpp | 3 +++
1 file changed, 3 insertions(+)

diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp
index 7d52e9a..1ca7749 100644
--- a/ipc/glue/MessagePump.cpp
+++ b/ipc/glue/MessagePump.cpp
@@ -223,6 +223,9 @@ DoWorkRunnable::Run()
{
MessageLoop* loop = MessageLoop::current();
MOZ_ASSERT(loop);
+ if (!loop) {
+ return NS_ERROR_NULL_POINTER;
+ }

bool nestableTasksAllowed = loop->NestableTasksAllowed();

--
2.1.4

@@ -1,9 +1,11 @@
From be9de584dc5e41896556468fb5b1ccf143bcadf9 Mon Sep 17 00:00:00 2001
From 9dc8a17b09b2a52879cef7d80bcc8e18f87be233 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
Date: Mon, 11 May 2015 13:13:03 +0300
Subject: [PATCH 2/4] Define HAS_NEMO_RESOURCE in config
Subject: [PATCH 06/11] Define HAS_NEMO_RESOURCE in config

See bugs 10947, 30305, and 30517
See bugs JB10947, JB30305, and JB30517

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
configure.in | 4 ++++
1 file changed, 4 insertions(+)
Expand Down

0 comments on commit da61a9a

Please sign in to comment.