[webkit-changes] [WebKit/WebKit] 0d46fa: [GStreamer] Fix media player's duration calculation

Enrique Ocaña González noreply at github.com
Tue Sep 20 10:24:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0d46fa12c99c41a159a9ae5d394a032ec09fd165
      https://github.com/WebKit/WebKit/commit/0d46fa12c99c41a159a9ae5d394a032ec09fd165
  Author: Enrique Ocaña González <eocanha at igalia.com>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M Source/WTF/wtf/PrintStream.h
    M Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
    M Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

  Log Message:
  -----------
  [GStreamer] Fix media player's duration calculation
https://bugs.webkit.org/show_bug.cgi?id=245148

Reviewed by Xabier Rodriguez-Calvar.

Videos without an initially known duration, such as https://traffic.megaphone.fm/GLT1153394917.mp3?updated=1617734730,
are currently detected as infinite videos (live streams). They should be detected as
fixed-length videos instead of as a live broadcast.

This patch changes the behaviour to return invalid time when the video is known not
to be live.

Based on a patch by: Pawel Lampe <pawel.lampe at gmail.com>
See: https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/923

* Source/WTF/wtf/PrintStream.h:
(WTF::boolForPrinting): Added overloaded function to print std::optional<bool> values.
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::seek): Migrate to optional m_isLiveStream preserving the previous behaviour (unset means false).
(WebCore::MediaPlayerPrivateGStreamer::setRate): ditto.
(WebCore::MediaPlayerPrivateGStreamer::setPreload): ditto.
(WebCore::MediaPlayerPrivateGStreamer::buffered const): ditto.
(WebCore::MediaPlayerPrivateGStreamer::maxMediaTimeSeekable const): ditto.
(WebCore::MediaPlayerPrivateGStreamer::totalBytes const): ditto.
(WebCore::MediaPlayerPrivateGStreamer::platformDuration const): Return invalid time when the duration is unknown and we're completely sure that the video isn't live.
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Migrate to optional m_isLiveStream preserving the previous behaviour (unset means false).
(WebCore::MediaPlayerPrivateGStreamer::updateStates): ditto.
(WebCore::MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag): ditto.
(WebCore::MediaPlayerPrivateGStreamer::canSaveMediaData const): ditto.
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): ditto.
(WebCore::MediaPlayerPrivateGStreamer::movieLoadType const): ditto.
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: m_isLiveStream is now std::optional<bool>.

Canonical link: https://commits.webkit.org/254682@main




More information about the webkit-changes mailing list