Skip to content

Commit

Permalink
Merge r236679 - [MSE][GStreamer] Set a minimum sample duration
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=190125

Reviewed by Xabier Rodriguez-Calvar.

The last sample of the audio track in the asset used in this test
player has a tiny duration (100 ns):

http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest

So small, we were truncating it to zero. We're not supposed to have
frames with zero duration. Instead, lets set a minimum frame duration
for those fringe cases.

* platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
  • Loading branch information
ntrrgc authored and aperezdc committed Oct 1, 2018
1 parent ff114ba commit 6e46185
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
19 changes: 19 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
2018-10-01 Alicia Boya García <aboya@igalia.com>

[MSE][GStreamer] Set a minimum sample duration
https://bugs.webkit.org/show_bug.cgi?id=190125

Reviewed by Xabier Rodriguez-Calvar.

The last sample of the audio track in the asset used in this test
player has a tiny duration (100 ns):

http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest

So small, we were truncating it to zero. We're not supposed to have
frames with zero duration. Instead, lets set a minimum frame duration
for those fringe cases.

* platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::MediaSampleGStreamer):

2018-10-01 Olivier Blin <olivier.blin@softathome.com>

[WPE] fix buffer over-read in RenderThemeWPE::mediaControlsStyleSheet()
Expand Down
Expand Up @@ -23,6 +23,8 @@

#include "GStreamerCommon.h"

#include <algorithm>

#if ENABLE(VIDEO) && USE(GSTREAMER)

namespace WebCore {
Expand All @@ -34,6 +36,7 @@ MediaSampleGStreamer::MediaSampleGStreamer(GRefPtr<GstSample>&& sample, const Fl
, m_trackId(trackId)
, m_presentationSize(presentationSize)
{
const GstClockTime minimumDuration = 1000; // 1 us
ASSERT(sample);
GstBuffer* buffer = gst_sample_get_buffer(sample.get());
RELEASE_ASSERT(buffer);
Expand All @@ -47,9 +50,14 @@ MediaSampleGStreamer::MediaSampleGStreamer(GRefPtr<GstSample>&& sample, const Fl
m_pts = createMediaTime(GST_BUFFER_PTS(buffer));
if (GST_BUFFER_DTS_IS_VALID(buffer) || GST_BUFFER_PTS_IS_VALID(buffer))
m_dts = createMediaTime(GST_BUFFER_DTS_OR_PTS(buffer));
if (GST_BUFFER_DURATION_IS_VALID(buffer))
m_duration = createMediaTime(GST_BUFFER_DURATION(buffer));
else {
if (GST_BUFFER_DURATION_IS_VALID(buffer)) {
// Sometimes (albeit rarely, so far seen only at the end of a track)
// frames have very small durations, so small that may be under the
// precision we are working with and be truncated to zero.
// SourceBuffer algorithms are not expecting frames with zero-duration,
// so let's use something very small instead in those fringe cases.
m_duration = createMediaTime(std::max(GST_BUFFER_DURATION(buffer), minimumDuration));
} else {
// Unfortunately, sometimes samples don't provide a duration. This can never happen in MP4 because of the way
// the format is laid out, but it's pretty common in WebM.
// The good part is that durations don't matter for playback, just for buffered ranges and coded frame deletion.
Expand Down

0 comments on commit 6e46185

Please sign in to comment.