[GStreamer] Refactor media player to use MediaTime consistently
authoreocanha@igalia.com <eocanha@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Sep 2017 10:22:12 +0000 (10:22 +0000)
committereocanha@igalia.com <eocanha@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Sep 2017 10:22:12 +0000 (10:22 +0000)
commit0316de323a462696a4aa99377283e8a10370f779
treedec4774b3d81e72c092ab211f6529cc09adad352
parenta584f831e8790fe1ba2d9e96a91792ee527d6350
[GStreamer] Refactor media player to use MediaTime consistently
https://bugs.webkit.org/show_bug.cgi?id=174817

Reviewed by Xabier Rodriguez-Calvar.

Make consistent use of the MediaTime class in the GStreamer media
player implementations.

This patch is authored by Charlie Turner <cturner@igalia.com> plus
some minor modifications by Enrique: migration of m_cachedPosition,
usage of m_seekTime as MediaTime in the MSE player and more logging
using toString().

Covered by existing tests.

* platform/graphics/gstreamer/GStreamerUtilities.cpp:
(WebCore::toGstUnsigned64Time): Scales MediaTime to the precision used
by GStreamer and returns a value compatible with GstClockTime.
(WebCore::toGstClockTime): Deleted.
* platform/graphics/gstreamer/GStreamerUtilities.h:
(WebCore::toGstClockTime): Inlined, now it takes MediaTime and converts
to GstClockTime.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
Several changes to use MediaTime instead of float and to log MediaTime
values converting them toString().
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::load):
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
(WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const):
(WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
(WebCore::MediaPlayerPrivateGStreamer::seek): Uses MediaTime.
(WebCore::MediaPlayerPrivateGStreamer::doSeek):
(WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
(WebCore::MediaPlayerPrivateGStreamer::buffered const):
(WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
(WebCore::MediaPlayerPrivateGStreamer::maxMediaTimeSeekable const):
(WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const):
(WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
(WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone):
(WebCore::MediaPlayerPrivateGStreamer::updateStates):
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
(WebCore::MediaPlayerPrivateGStreamer::durationChanged):
(WebCore::MediaPlayerPrivateGStreamer::maxTimeSeekable const): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Changed
seek(), playBackposition(), m_cachedPosition, m_durationAtEOS,
m_seekTime and m_timeOfOverlappingSeek to be of MediaTime type.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
Prefer the methods based on MediaTime over those based on fload/double.
(WebCore::MediaPlayerPrivateGStreamerBase::maxTimeLoaded const):
* platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp:
(WebCore::GStreamerMediaSample::offsetTimestampsBy): toGstClockTime()
now can handle MediaTime.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
Several changes to use MediaTime instead of float and to log MediaTime
values converting them toString().
(WebCore::MediaPlayerPrivateGStreamerMSE::seek):
(WebCore::MediaPlayerPrivateGStreamerMSE::notifySeekNeedsDataForTime):
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::isTimeBuffered const):
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
(WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime const):
(WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable const):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
seek() now takes a MediaTime argument.
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
(WebCore::PlaybackPipeline::enqueueSample): Use MediaTime values in
MediaSample.
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcQueryWithParent): Use MediaTime values in
durationMediaTime().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222649 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp
Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp
Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp