Changeset 232014 in webkit


Ignore:
Timestamp:
May 21, 2018 4:52:33 AM (6 years ago)
Author:
aboya@igalia.com
Message:

[MSE][GStreamer] Force segment.start = 0 after matroskademux
https://bugs.webkit.org/show_bug.cgi?id=185740

Reviewed by Xabier Rodriguez-Calvar.

This patch ensures that when WebM MSE media segments are appended in
an out of order fashion their frames are not discarded by opusparse or
any other potential elements downstream in the AppendPipeline that
perform segment clipping.

This patch fixes the following YTTV 2018 tests:

  1. OpusAudioWithOverlap
  2. OpusAudioWithSmallGap
  3. OpusAudioWithLargeGap
  4. VP9VideoWithOverlap
  5. VP9VideoWithSmallGap

This patch is necessary, but not sufficient for fixing the following
YTTV 2018 tests:

  1. AppendOpusAudioOutOfOrder
  2. AppendVP9VideoOutOfOrder
  • platform/graphics/gstreamer/mse/AppendPipeline.cpp:

(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
(WebCore::matroskademuxForceSegmentStartToEqualZero):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r232001 r232014  
     12018-05-21  Alicia Boya García  <aboya@igalia.com>
     2
     3        [MSE][GStreamer] Force segment.start = 0 after matroskademux
     4        https://bugs.webkit.org/show_bug.cgi?id=185740
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        This patch ensures that when WebM MSE media segments are appended in
     9        an out of order fashion their frames are not discarded by opusparse or
     10        any other potential elements downstream in the AppendPipeline that
     11        perform segment clipping.
     12
     13        This patch fixes the following YTTV 2018 tests:
     14
     15        38. OpusAudioWithOverlap
     16        39. OpusAudioWithSmallGap
     17        40. OpusAudioWithLargeGap
     18        70. VP9VideoWithOverlap
     19        71. VP9VideoWithSmallGap
     20
     21        This patch is necessary, but not sufficient for fixing the following
     22        YTTV 2018 tests:
     23
     24        36. AppendOpusAudioOutOfOrder
     25        67. AppendVP9VideoOutOfOrder
     26
     27        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
     28        (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
     29        (WebCore::matroskademuxForceSegmentStartToEqualZero):
     30
    1312018-05-19  Eric Carlson  <eric.carlson@apple.com>
    232
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp

    r231636 r232014  
    8686static void appendPipelineAppsinkEOS(GstElement*, AppendPipeline*);
    8787
     88static GstPadProbeReturn matroskademuxForceSegmentStartToEqualZero(GstPad*, GstPadProbeInfo*, void*);
     89
    8890static void appendPipelineNeedContextMessageCallback(GstBus*, GstMessage* message, AppendPipeline* appendPipeline)
    8991{
     
    979981    GST_DEBUG("Connecting to appsink");
    980982
     983    const String& type = m_sourceBufferPrivate->type().containerType();
     984    if (type.endsWith("webm"))
     985        gst_pad_add_probe(demuxerSrcPad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, matroskademuxForceSegmentStartToEqualZero, nullptr, nullptr);
     986
    981987    LockHolder locker(m_padAddRemoveLock);
    982988    GRefPtr<GstPad> sinkSinkPad = adoptGRef(gst_element_get_static_pad(m_appsink.get(), "sink"));
     
    11491155}
    11501156
    1151 
     1157static GstPadProbeReturn matroskademuxForceSegmentStartToEqualZero(GstPad*, GstPadProbeInfo* info, void*)
     1158{
     1159    // matroskademux sets GstSegment.start to the PTS of the first frame.
     1160    //
     1161    // This way in the unlikely case a user made a .mkv or .webm file where a certain portion of the movie is skipped
     1162    // (e.g. by concatenating a MSE initialization segment with any MSE media segment other than the first) and opened
     1163    // it with a regular player, playback would start immediately. GstSegment.duration is not modified in any case.
     1164    //
     1165    // Leaving the usefulness of that feature aside, the fact that it uses GstSegment.start is problematic for MSE.
     1166    // In MSE is not unusual to process unordered MSE media segments. In this case, a frame may have
     1167    // PTS <<< GstSegment.start and be discarded by downstream. This happens for instance in elements derived from
     1168    // audiobasefilter, such as opusparse.
     1169    //
     1170    // This probe remedies the problem by setting GstSegment.start to 0 in all cases, not only when the PTS of the first
     1171    // frame is zero.
     1172
     1173    ASSERT(info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM);
     1174    GstEvent* event = static_cast<GstEvent*>(info->data);
     1175    if (event->type == GST_EVENT_SEGMENT) {
     1176        GstSegment segment;
     1177        gst_event_copy_segment(event, &segment);
     1178
     1179        segment.start = 0;
     1180
     1181        GRefPtr<GstEvent> newEvent = adoptGRef(gst_event_new_segment(&segment));
     1182        gst_event_replace(reinterpret_cast<GstEvent**>(&info->data), newEvent.get());
     1183    }
     1184    return GST_PAD_PROBE_OK;
     1185}
    11521186
    11531187} // namespace WebCore.
Note: See TracChangeset for help on using the changeset viewer.