[GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
authoreocanha@igalia.com <eocanha@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2017 10:59:17 +0000 (10:59 +0000)
committereocanha@igalia.com <eocanha@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2017 10:59:17 +0000 (10:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166529

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
in qtdemux anymore.

Tools:

* gtk/patches/gst-plugins-good-use-the-tfdt-decode-time.patch:
New patch version accepted in GStreamer upstream.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211478 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
Tools/ChangeLog
Tools/gtk/patches/gst-plugins-good-use-the-tfdt-decode-time.patch

index 597bb60..7b0fcb4 100644 (file)
@@ -1,3 +1,14 @@
+2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
+
+        [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
+        https://bugs.webkit.org/show_bug.cgi?id=166529
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+        (WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
+        in qtdemux anymore.
+
 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Unreviewed, build fix for macOS and iOS ports, part 2
index 493ec92..4a84655 100644 (file)
@@ -122,7 +122,6 @@ AppendPipeline::AppendPipeline(Ref<MediaSourceClientGStreamerMSE> mediaSourceCli
     m_demux = gst_element_factory_make("qtdemux", nullptr);
     m_appsink = gst_element_factory_make("appsink", nullptr);
 
-    g_object_set(G_OBJECT(m_demux.get()), "always-honor-tfdt", TRUE, nullptr);
     gst_app_sink_set_emit_signals(GST_APP_SINK(m_appsink.get()), TRUE);
     gst_base_sink_set_sync(GST_BASE_SINK(m_appsink.get()), FALSE);
 
index 724d2ce..19f3edd 100644 (file)
@@ -1,3 +1,13 @@
+2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
+
+        [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
+        https://bugs.webkit.org/show_bug.cgi?id=166529
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * gtk/patches/gst-plugins-good-use-the-tfdt-decode-time.patch:
+        New patch version accepted in GStreamer upstream.
+
 2017-02-01  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GTK] Install either libxfont1-dev or libxfont-dev as dependency
index 1e9dd97..c3c08df 100644 (file)
-From 46d3e0faa922643094a5e46a32e4f82f774ae772 Mon Sep 17 00:00:00 2001
+From 1556043c00eb60d3871b4baa8b029175c16c7097 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
-Date: Tue, 10 Nov 2015 13:09:00 +0100
-Subject: [PATCH] Use the tfdt decode time when it's significantly different
- than the time in the last sample if always-honor-tfdt is enabled
+Date: Mon, 24 Oct 2016 16:56:31 +0000
+Subject: [PATCH] Use the tfdt decode time on byte streams when it's
+ significantly different than the time in the last sample
+
+We consider there's a sifnificant difference when it's larger than on second
+or than half the duration of the last processed fragment in case the latter is
+larger.
 
 https://bugzilla.gnome.org/show_bug.cgi?id=754230
 ---
- gst/isomp4/qtdemux.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
- gst/isomp4/qtdemux.h |  1 +
- 2 files changed, 73 insertions(+)
+ gst/isomp4/qtdemux.c | 25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
 
 diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
-index 880595e..d8b54f0 100644
+index db2d361..5430a39 100644
 --- a/gst/isomp4/qtdemux.c
 +++ b/gst/isomp4/qtdemux.c
-@@ -535,6 +535,11 @@ static void gst_qtdemux_append_protection_system_id (GstQTDemux * qtdemux,
-     const gchar * id);
- static void qtdemux_gst_structure_free (GstStructure * gststructure);
+@@ -95,6 +95,8 @@
+ #define STREAM_IS_EOS(s) (s->time_position == GST_CLOCK_TIME_NONE)
  
-+static void gst_qtdemux_set_property (GObject * object, guint prop_id,
-+    const GValue * value, GParamSpec * spec);
-+static void gst_qtdemux_get_property (GObject * object, guint prop_id,
-+    GValue * value, GParamSpec * spec);
++#define ABSDIFF(x, y) ( (x) > (y) ? ((x) - (y)) : ((y) - (x)) )
 +
- static void
- gst_qtdemux_class_init (GstQTDemuxClass * klass)
- {
-@@ -546,8 +551,21 @@ gst_qtdemux_class_init (GstQTDemuxClass * klass)
+ GST_DEBUG_CATEGORY (qtdemux_debug);
  
-   parent_class = g_type_class_peek_parent (klass);
+ /*typedef struct _QtNode QtNode; */
+@@ -256,6 +258,7 @@ struct _QtDemuxStream
+   guint32 n_samples_moof;       /* sample count in a moof */
+   guint64 duration_moof;        /* duration in timescale of a moof, used for figure out
+                                  * the framerate of fragmented format stream */
++  guint64 duration_last_moof;
+   guint32 offset_in_sample;
+   guint32 max_buffer_size;
  
-+  gobject_class->set_property = gst_qtdemux_set_property;
-+  gobject_class->get_property = gst_qtdemux_get_property;
-+
-   gobject_class->dispose = gst_qtdemux_dispose;
+@@ -1828,6 +1831,7 @@ _create_stream (void)
+   stream->protection_scheme_info = NULL;
+   stream->n_samples_moof = 0;
+   stream->duration_moof = 0;
++  stream->duration_last_moof = 0;
+   g_queue_init (&stream->protection_scheme_event_queue);
+   return stream;
+ }
+@@ -2315,6 +2319,7 @@ gst_qtdemux_stream_flush_samples_data (GstQTDemux * qtdemux,
  
-+ /**
-+   * GstQtDemux::always-honor-tfdt:
-+   *
-+   * Requests the demuxer to respect what the TFDT atom says in order to produce presentation timestamps. Defaults to FALSE.
-+   */
-+  g_object_class_install_property (gobject_class, PROP_ALWAYS_HONOR_TFDT,
-+      g_param_spec_boolean ("always-honor-tfdt", "Always honor TFDT",
-+          "When enabled, TFDT atom will always be respected in order to produce presentation timestamps",
-+          FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-+
-   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_qtdemux_change_state);
- #if 0
-   gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_qtdemux_set_index);
-@@ -611,6 +629,7 @@ gst_qtdemux_init (GstQTDemux * qtdemux)
-   qtdemux->cenc_aux_info_sizes = NULL;
-   qtdemux->cenc_aux_sample_count = 0;
-   qtdemux->protection_system_ids = NULL;
-+  qtdemux->always_honor_tfdt = FALSE;
-   g_queue_init (&qtdemux->protection_event_queue);
-   gst_segment_init (&qtdemux->segment, GST_FORMAT_TIME);
-   qtdemux->flowcombiner = gst_flow_combiner_new ();
-@@ -639,6 +658,42 @@ gst_qtdemux_dispose (GObject * object)
+   stream->n_samples_moof = 0;
+   stream->duration_moof = 0;
++  stream->duration_last_moof = 0;
  }
  
  static void
-+gst_qtdemux_set_property (GObject * object, guint prop_id,
-+    const GValue * value, GParamSpec * pspec)
-+{
-+  GstQTDemux *qtdemux = GST_QTDEMUX (object);
-+
-+  switch (prop_id) {
-+    case PROP_ALWAYS_HONOR_TFDT:
-+      GST_OBJECT_LOCK (qtdemux);
-+      qtdemux->always_honor_tfdt = g_value_get_boolean (value);
-+      GST_OBJECT_UNLOCK (qtdemux);
-+      break;
-+    default:
-+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-+      break;
-+  }
-+}
-+
-+static void
-+gst_qtdemux_get_property (GObject * object, guint prop_id, GValue * value,
-+    GParamSpec * pspec)
-+{
-+  GstQTDemux *qtdemux = GST_QTDEMUX (object);
-+
-+  switch (prop_id) {
-+    case PROP_ALWAYS_HONOR_TFDT:
-+      GST_OBJECT_LOCK (qtdemux);
-+      g_value_set_boolean (value, qtdemux->always_honor_tfdt);
-+      GST_OBJECT_UNLOCK (qtdemux);
-+      break;
-+    default:
-+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-+      break;
-+  }
-+}
-+
-+static void
- gst_qtdemux_post_no_playable_stream_error (GstQTDemux * qtdemux)
- {
-   if (qtdemux->posted_redirect) {
-@@ -2995,6 +3050,16 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun,
+@@ -2883,6 +2888,25 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun,
            stream->samples[stream->n_samples - 1].timestamp +
            stream->samples[stream->n_samples - 1].duration;
  
-+      /* If we're always honoring TFDT and there's a significative difference
-+       * between the decode_ts and the timestamp, prefer decode_ts */
-+      if (qtdemux->always_honor_tfdt == TRUE
-+          && abs (decode_ts - timestamp) >
-+          stream->samples[stream->n_samples - 1].duration) {
++      /* If this is a GST_FORMAT_BYTES stream and there's a significant
++       * difference (1 sec.) between decode_ts and timestamp, prefer the
++       * former */
++      if (!qtdemux->upstream_format_is_time
++          && ABSDIFF (decode_ts, timestamp) >
++          MAX (stream->duration_last_moof / 2,
++              GSTTIME_TO_QTSTREAMTIME (stream, GST_SECOND))) {
 +        GST_INFO_OBJECT (qtdemux,
-+            "decode_ts is significantly different from timestamp, using decode_ts");
++            "decode_ts (%" GST_TIME_FORMAT ") and timestamp (%" GST_TIME_FORMAT
++            ") are significantly different (more than %" GST_TIME_FORMAT
++            "), using decode_ts",
++            GST_TIME_ARGS (QTSTREAMTIME_TO_GSTTIME (stream, decode_ts)),
++            GST_TIME_ARGS (QTSTREAMTIME_TO_GSTTIME (stream, timestamp)),
++            GST_TIME_ARGS (QTSTREAMTIME_TO_GSTTIME (stream,
++                    MAX (stream->duration_last_moof / 2,
++                        GSTTIME_TO_QTSTREAMTIME (stream, GST_SECOND)))));
 +        timestamp = decode_ts;
 +      }
 +
        gst_ts = QTSTREAMTIME_TO_GSTTIME (stream, timestamp);
        GST_INFO_OBJECT (qtdemux, "first sample ts %" GST_TIME_FORMAT
            " (extends previous samples)", GST_TIME_ARGS (gst_ts));
-diff --git a/gst/isomp4/qtdemux.h b/gst/isomp4/qtdemux.h
-index 53bd071..ecf0c63 100644
---- a/gst/isomp4/qtdemux.h
-+++ b/gst/isomp4/qtdemux.h
-@@ -154,12 +154,20 @@ struct _GstQTDemux {
-   guint8 *cenc_aux_info_sizes;
-   guint32 cenc_aux_sample_count;
+@@ -3544,6 +3568,7 @@ qtdemux_parse_moof (GstQTDemux * qtdemux, const guint8 * buffer, guint length,
  
-+  gboolean always_honor_tfdt;
- };
- struct _GstQTDemuxClass {
-   GstElementClass parent_class;
- };
-+/* props */
-+enum
-+{
-+  PROP_0,
-+  PROP_ALWAYS_HONOR_TFDT
-+};
-+
- GType gst_qtdemux_get_type (void);
+     /* initialise moof sample data */
+     stream->n_samples_moof = 0;
++    stream->duration_last_moof = stream->duration_moof;
+     stream->duration_moof = 0;
  
- G_END_DECLS
+     /* Track Run node */
 -- 
-2.6.1
+2.1.4