Diff
Modified: trunk/LayoutTests/ChangeLog (169567 => 169568)
--- trunk/LayoutTests/ChangeLog 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/LayoutTests/ChangeLog 2014-06-03 21:09:07 UTC (rev 169568)
@@ -1,3 +1,15 @@
+2014-06-02 Jer Noble <jer.no...@apple.com>
+
+ Update PlatformTimeRanges to use MediaTime rather than doubles for time values.
+ https://bugs.webkit.org/show_bug.cgi?id=133454
+
+ Reviewed by Eric Carlson.
+
+ Update the video-pause-immediately to allow for small floating point differences.
+
+ * media/video-pause-immediately-expected.txt:
+ * media/video-pause-immediately.html:
+
2014-06-03 Eva Balazsfalvi <evab.u-sze...@partner.samsung.com>
REGRESSION(r169092 and r169102): Skip failing JSC tests poperly on non-x86 Darwin platforms
Modified: trunk/LayoutTests/media/video-pause-immediately-expected.txt (169567 => 169568)
--- trunk/LayoutTests/media/video-pause-immediately-expected.txt 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/LayoutTests/media/video-pause-immediately-expected.txt 2014-06-03 21:09:07 UTC (rev 169568)
@@ -4,7 +4,7 @@
EVENT(canplay)
EVENT(playing)
EVENT(pause)
-EXPECTED ((video.currentTime - timeAfterPause) == '0') OK
-EXPECTED ((video.played.end(0) - timeAfterPause) == '0') OK
+EXPECTED ((video.currentTime - timeAfterPause) < '0.0001') OK
+EXPECTED ((video.played.end(0) - timeAfterPause) < '0.0001') OK
END OF TEST
Modified: trunk/LayoutTests/media/video-pause-immediately.html (169567 => 169568)
--- trunk/LayoutTests/media/video-pause-immediately.html 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/LayoutTests/media/video-pause-immediately.html 2014-06-03 21:09:07 UTC (rev 169568)
@@ -36,8 +36,8 @@
function pause()
{
- testExpected("(video.currentTime - timeAfterPause)", 0);
- testExpected("(video.played.end(0) - timeAfterPause)", 0);
+ testExpected("(video.currentTime - timeAfterPause)", 0.0001, "<");
+ testExpected("(video.played.end(0) - timeAfterPause)", 0.0001, "<");
endTest();
}
</script>
Modified: trunk/Source/WebCore/ChangeLog (169567 => 169568)
--- trunk/Source/WebCore/ChangeLog 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/ChangeLog 2014-06-03 21:09:07 UTC (rev 169568)
@@ -1,3 +1,61 @@
+2014-06-02 Jer Noble <jer.no...@apple.com>
+
+ Update PlatformTimeRanges to use MediaTime rather than doubles for time values.
+ https://bugs.webkit.org/show_bug.cgi?id=133454
+
+ Reviewed by Eric Carlson.
+
+ PlatformTimeRanges will now use MediaTime, so operations at the platform level won't
+ lose precision when converting to and from doubles and rational time values like CMTime.
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::currentTimeFudgeFactor):
+ (WebCore::SourceBuffer::hasCurrentTime):
+ (WebCore::SourceBuffer::hasFutureTime):
+ (WebCore::SourceBuffer::canPlayThrough):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::parseAttribute):
+ * html/TimeRanges.cpp:
+ (WebCore::TimeRanges::TimeRanges):
+ (WebCore::TimeRanges::start):
+ (WebCore::TimeRanges::end):
+ (WebCore::TimeRanges::add):
+ (WebCore::TimeRanges::contain):
+ (WebCore::TimeRanges::find):
+ (WebCore::TimeRanges::nearest):
+ (WebCore::TimeRanges::totalDuration):
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::seekable):
+ * platform/graphics/PlatformTimeRanges.cpp:
+ (WebCore::PlatformTimeRanges::create):
+ (WebCore::PlatformTimeRanges::PlatformTimeRanges):
+ (WebCore::PlatformTimeRanges::invert):
+ (WebCore::PlatformTimeRanges::start):
+ (WebCore::PlatformTimeRanges::end):
+ (WebCore::PlatformTimeRanges::add):
+ (WebCore::PlatformTimeRanges::contain):
+ (WebCore::PlatformTimeRanges::find):
+ (WebCore::PlatformTimeRanges::nearest):
+ (WebCore::PlatformTimeRanges::totalDuration):
+ * platform/graphics/PlatformTimeRanges.h:
+ (WebCore::PlatformTimeRanges::Range::Range):
+ (WebCore::PlatformTimeRanges::Range::isPointInRange):
+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundation::extraMemoryCost):
+ * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRanges):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekable):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::buffered): Deleted.
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivateQTKit::buffered):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::buffered):
+ * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
+ (WebCore::MockMediaPlayerMediaSource::advanceCurrentTime):
+
2014-06-03 Benjamin Poulain <bpoul...@apple.com>
[iOS][WK2] Align the highlight rects with device pixels
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (169567 => 169568)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -60,7 +60,11 @@
static double ExponentialMovingAverageCoefficient = 0.1;
// Allow hasCurrentTime() to be off by as much as the length of a 24fps video frame
-static double CurrentTimeFudgeFactor = 1. / 24;
+static const MediaTime& currentTimeFudgeFactor()
+{
+ static NeverDestroyed<MediaTime> fudgeFactor(1, 24);
+ return fudgeFactor;
+}
struct SourceBuffer::TrackBuffer {
MediaTime lastDecodeTimestamp;
@@ -1385,8 +1389,8 @@
if (isRemoved() || !m_buffered->length())
return false;
- double currentTime = m_source->currentTime();
- return fabs(m_buffered->nearest(m_source->currentTime()) - currentTime) <= CurrentTimeFudgeFactor;
+ MediaTime currentTime = MediaTime::createWithDouble(m_source->currentTime());
+ return abs(m_buffered->ranges().nearest(currentTime) - currentTime) <= currentTimeFudgeFactor();
}
bool SourceBuffer::hasFutureTime() const
@@ -1394,20 +1398,20 @@
if (isRemoved())
return false;
- double currentTime = m_source->currentTime();
const PlatformTimeRanges& ranges = m_buffered->ranges();
if (!ranges.length())
return false;
- double nearest = m_buffered->nearest(m_source->currentTime());
- if (fabs(m_buffered->nearest(m_source->currentTime()) - currentTime) > CurrentTimeFudgeFactor)
+ MediaTime currentTime = MediaTime::createWithDouble(m_source->currentTime());
+ MediaTime nearest = ranges.nearest(currentTime);
+ if (abs(nearest - currentTime) > currentTimeFudgeFactor())
return false;
size_t found = ranges.find(nearest);
ASSERT(found != notFound);
bool ignoredValid = false;
- return ranges.end(found, ignoredValid) - currentTime > CurrentTimeFudgeFactor;
+ return ranges.end(found, ignoredValid) - currentTime > currentTimeFudgeFactor();
}
bool SourceBuffer::canPlayThrough()
@@ -1423,9 +1427,9 @@
return true;
// Add up all the time yet to be buffered.
- double unbufferedTime = 0;
- double currentTime = m_source->currentTime();
- double duration = m_source->duration();
+ MediaTime unbufferedTime = MediaTime::zeroTime();
+ MediaTime currentTime = MediaTime::createWithDouble(m_source->currentTime());
+ MediaTime duration = MediaTime::createWithDouble(m_source->duration());
PlatformTimeRanges unbufferedRanges = m_buffered->ranges();
unbufferedRanges.invert();
@@ -1435,8 +1439,8 @@
for (size_t i = 0, end = unbufferedRanges.length(); i < end; ++i)
unbufferedTime += unbufferedRanges.end(i, valid) - unbufferedRanges.start(i, valid);
- double timeRemaining = duration - currentTime;
- return unbufferedTime / m_averageBufferRate < timeRemaining;
+ MediaTime timeRemaining = duration - currentTime;
+ return unbufferedTime.toDouble() / m_averageBufferRate < timeRemaining.toDouble();
}
void SourceBuffer::reportExtraMemoryCost()
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (169567 => 169568)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -3165,15 +3165,15 @@
if (!duration || std::isinf(duration))
return 0;
- double buffered = 0;
+ MediaTime buffered = MediaTime::zeroTime();
bool ignored;
std::unique_ptr<PlatformTimeRanges> timeRanges = m_player->buffered();
for (unsigned i = 0; i < timeRanges->length(); ++i) {
- double start = timeRanges->start(i, ignored);
- double end = timeRanges->end(i, ignored);
+ MediaTime start = timeRanges->start(i, ignored);
+ MediaTime end = timeRanges->end(i, ignored);
buffered += end - start;
}
- return buffered / duration;
+ return buffered.toDouble() / duration;
}
#if ENABLE(VIDEO_TRACK)
Modified: trunk/Source/WebCore/html/TimeRanges.cpp (169567 => 169568)
--- trunk/Source/WebCore/html/TimeRanges.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/html/TimeRanges.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -52,7 +52,7 @@
}
TimeRanges::TimeRanges(double start, double end)
- : m_ranges(PlatformTimeRanges(start, end))
+ : m_ranges(PlatformTimeRanges(MediaTime::createWithDouble(start), MediaTime::createWithDouble(end)))
{
}
@@ -64,25 +64,25 @@
double TimeRanges::start(unsigned index, ExceptionCode& ec) const
{
bool valid;
- double result = m_ranges.start(index, valid);
+ MediaTime result = m_ranges.start(index, valid);
if (!valid) {
ec = INDEX_SIZE_ERR;
return 0;
}
- return result;
+ return result.toDouble();
}
double TimeRanges::end(unsigned index, ExceptionCode& ec) const
{
bool valid;
- double result = m_ranges.end(index, valid);
+ MediaTime result = m_ranges.end(index, valid);
if (!valid) {
ec = INDEX_SIZE_ERR;
return 0;
}
- return result;
+ return result.toDouble();
}
void TimeRanges::invert()
@@ -112,27 +112,27 @@
void TimeRanges::add(double start, double end)
{
- m_ranges.add(start, end);
+ m_ranges.add(MediaTime::createWithDouble(start), MediaTime::createWithDouble(end));
}
bool TimeRanges::contain(double time) const
{
- return m_ranges.contain(time);
+ return m_ranges.contain(MediaTime::createWithDouble(time));
}
size_t TimeRanges::find(double time) const
{
- return m_ranges.find(time);
+ return m_ranges.find(MediaTime::createWithDouble(time));
}
double TimeRanges::nearest(double time) const
{
- return m_ranges.nearest(time);
+ return m_ranges.nearest(MediaTime::createWithDouble(time)).toDouble();
}
double TimeRanges::totalDuration() const
{
- return m_ranges.totalDuration();
+ return m_ranges.totalDuration().toDouble();
}
}
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-06-03 21:09:07 UTC (rev 169568)
@@ -119,7 +119,7 @@
virtual MediaPlayer::NetworkState networkState() const = 0;
virtual MediaPlayer::ReadyState readyState() const = 0;
- virtual std::unique_ptr<PlatformTimeRanges> seekable() const { return maxTimeSeekableDouble() ? PlatformTimeRanges::create(minTimeSeekable(), maxTimeSeekableDouble()) : PlatformTimeRanges::create(); }
+ virtual std::unique_ptr<PlatformTimeRanges> seekable() const { return maxTimeSeekableDouble() ? PlatformTimeRanges::create(MediaTime::createWithDouble(minTimeSeekable()), MediaTime::createWithDouble(maxTimeSeekableDouble())) : PlatformTimeRanges::create(); }
virtual float maxTimeSeekable() const { return 0; }
virtual double maxTimeSeekableDouble() const { return maxTimeSeekable(); }
virtual double minTimeSeekable() const { return 0; }
Modified: trunk/Source/WebCore/platform/graphics/PlatformTimeRanges.cpp (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/PlatformTimeRanges.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/PlatformTimeRanges.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -35,7 +35,7 @@
return std::make_unique<PlatformTimeRanges>();
}
-std::unique_ptr<PlatformTimeRanges> PlatformTimeRanges::create(double start, double end)
+std::unique_ptr<PlatformTimeRanges> PlatformTimeRanges::create(const MediaTime& start, const MediaTime& end)
{
return std::make_unique<PlatformTimeRanges>(start, end);
}
@@ -45,7 +45,7 @@
return std::make_unique<PlatformTimeRanges>(other);
}
-PlatformTimeRanges::PlatformTimeRanges(double start, double end)
+PlatformTimeRanges::PlatformTimeRanges(const MediaTime& start, const MediaTime& end)
{
add(start, end);
}
@@ -72,20 +72,20 @@
void PlatformTimeRanges::invert()
{
PlatformTimeRanges inverted;
- double posInf = std::numeric_limits<double>::infinity();
- double negInf = -std::numeric_limits<double>::infinity();
+ MediaTime posInf = MediaTime::positiveInfiniteTime();
+ MediaTime negInf = MediaTime::negativeInfiniteTime();
if (!m_ranges.size())
inverted.add(negInf, posInf);
else {
- double start = m_ranges.first().m_start;
+ MediaTime start = m_ranges.first().m_start;
if (start != negInf)
inverted.add(negInf, start);
for (size_t index = 0; index + 1 < m_ranges.size(); ++index)
inverted.add(m_ranges[index].m_end, m_ranges[index + 1].m_start);
- double end = m_ranges.last().m_end;
+ MediaTime end = m_ranges.last().m_end;
if (end != posInf)
inverted.add(end, posInf);
}
@@ -115,29 +115,29 @@
m_ranges.swap(unioned.m_ranges);
}
-double PlatformTimeRanges::start(unsigned index, bool& valid) const
+MediaTime PlatformTimeRanges::start(unsigned index, bool& valid) const
{
if (index >= length()) {
valid = false;
- return 0;
+ return MediaTime::zeroTime();
}
valid = true;
return m_ranges[index].m_start;
}
-double PlatformTimeRanges::end(unsigned index, bool& valid) const
+MediaTime PlatformTimeRanges::end(unsigned index, bool& valid) const
{
if (index >= length()) {
valid = false;
- return 0;
+ return MediaTime::zeroTime();
}
valid = true;
return m_ranges[index].m_end;
}
-void PlatformTimeRanges::add(double start, double end)
+void PlatformTimeRanges::add(const MediaTime& start, const MediaTime& end)
{
ASSERT(start <= end);
unsigned overlappingArcIndex;
@@ -178,12 +178,12 @@
m_ranges.insert(overlappingArcIndex, addedRange);
}
-bool PlatformTimeRanges::contain(double time) const
+bool PlatformTimeRanges::contain(const MediaTime& time) const
{
return find(time) != notFound;
}
-size_t PlatformTimeRanges::find(double time) const
+size_t PlatformTimeRanges::find(const MediaTime& time) const
{
bool ignoreInvalid;
for (unsigned n = 0; n < length(); n++) {
@@ -193,26 +193,26 @@
return notFound;
}
-double PlatformTimeRanges::nearest(double time) const
+MediaTime PlatformTimeRanges::nearest(const MediaTime& time) const
{
- double closestDelta = std::numeric_limits<double>::infinity();
- double closestTime = 0;
+ MediaTime closestDelta = MediaTime::positiveInfiniteTime();
+ MediaTime closestTime = MediaTime::zeroTime();
unsigned count = length();
bool ignoreInvalid;
for (unsigned ndx = 0; ndx < count; ndx++) {
- double startTime = start(ndx, ignoreInvalid);
- double endTime = end(ndx, ignoreInvalid);
+ MediaTime startTime = start(ndx, ignoreInvalid);
+ MediaTime endTime = end(ndx, ignoreInvalid);
if (time >= startTime && time <= endTime)
return time;
- double startTimeDelta = fabs(startTime - time);
+ MediaTime startTimeDelta = abs(startTime - time);
if (startTimeDelta < closestDelta) {
closestTime = startTime;
closestDelta = startTimeDelta;
}
- double endTimeDelta = fabs(endTime - time);
+ MediaTime endTimeDelta = abs(endTime - time);
if (endTimeDelta < closestDelta) {
closestTime = endTime;
closestDelta = endTimeDelta;
@@ -221,13 +221,13 @@
return closestTime;
}
-double PlatformTimeRanges::totalDuration() const
+MediaTime PlatformTimeRanges::totalDuration() const
{
- double total = 0;
+ MediaTime total = MediaTime::zeroTime();
bool ignoreInvalid;
for (unsigned n = 0; n < length(); n++)
- total += fabs(end(n, ignoreInvalid) - start(n, ignoreInvalid));
+ total += abs(end(n, ignoreInvalid) - start(n, ignoreInvalid));
return total;
}
Modified: trunk/Source/WebCore/platform/graphics/PlatformTimeRanges.h (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/PlatformTimeRanges.h 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/PlatformTimeRanges.h 2014-06-03 21:09:07 UTC (rev 169568)
@@ -27,6 +27,7 @@
#define PlatformTimeRanges_h
#include <algorithm>
+#include <wtf/MediaTime.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -36,17 +37,17 @@
class PlatformTimeRanges {
public:
static std::unique_ptr<PlatformTimeRanges> create();
- static std::unique_ptr<PlatformTimeRanges> create(double start, double end);
+ static std::unique_ptr<PlatformTimeRanges> create(const MediaTime& start, const MediaTime& end);
static std::unique_ptr<PlatformTimeRanges> create(const PlatformTimeRanges&);
explicit PlatformTimeRanges() { }
- PlatformTimeRanges(double start, double end);
+ PlatformTimeRanges(const MediaTime& start, const MediaTime& end);
PlatformTimeRanges(const PlatformTimeRanges&);
PlatformTimeRanges& operator=(const PlatformTimeRanges&);
- double start(unsigned index, bool& valid) const;
- double end(unsigned index, bool& valid) const;
+ MediaTime start(unsigned index, bool& valid) const;
+ MediaTime end(unsigned index, bool& valid) const;
void invert();
void intersectWith(const PlatformTimeRanges&);
@@ -54,15 +55,15 @@
unsigned length() const { return m_ranges.size(); }
- void add(double start, double end);
+ void add(const MediaTime& start, const MediaTime& end);
- bool contain(double time) const;
+ bool contain(const MediaTime&) const;
- size_t find(double time) const;
+ size_t find(const MediaTime&) const;
- double nearest(double time) const;
+ MediaTime nearest(const MediaTime&) const;
- double totalDuration() const;
+ MediaTime totalDuration() const;
private:
PlatformTimeRanges& copy(const PlatformTimeRanges&);
@@ -70,15 +71,16 @@
// We consider all the Ranges to be semi-bounded as follow: [start, end[
struct Range {
Range() { }
- Range(double start, double end)
+ Range(const MediaTime& start, const MediaTime& end)
+ : m_start(start)
+ , m_end(end)
{
- m_start = start;
- m_end = end;
}
- double m_start;
- double m_end;
- inline bool isPointInRange(double point) const
+ MediaTime m_start;
+ MediaTime m_end;
+
+ inline bool isPointInRange(const MediaTime& point) const
{
return m_start <= point && point < m_end;
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -946,7 +946,7 @@
if (!duration)
return 0;
- unsigned long long extra = totalBytes() * buffered()->totalDuration() / duration;
+ unsigned long long extra = totalBytes() * buffered()->totalDuration().toDouble() / duration;
return static_cast<unsigned>(extra);
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -638,9 +638,9 @@
CMTime duration = CMTimeMakeFromDictionary(static_cast<CFDictionaryRef>(CFDictionaryGetValue(range, CMTimeRangeDurationKey())));
if (timeRangeIsValidAndNotEmpty(start, duration)) {
- float rangeStart = narrowPrecisionToFloat(CMTimeGetSeconds(start));
- float rangeEnd = narrowPrecisionToFloat(CMTimeGetSeconds(CMTimeAdd(start, duration)));
- timeRanges->add(rangeStart, rangeEnd);
+ double rangeStart = CMTimeGetSeconds(start);
+ double rangeEnd = rangeStart + CMTimeGetSeconds(duration);
+ timeRanges->add(MediaTime::createWithDouble(rangeStart), MediaTime::createWithDouble(rangeEnd));
}
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-06-03 21:09:07 UTC (rev 169568)
@@ -45,6 +45,7 @@
#import "OutOfBandTextTrackPrivateAVF.h"
#import "URL.h"
#import "Logging.h"
+#import "MediaTimeMac.h"
#import "PlatformTimeRanges.h"
#import "SecurityOrigin.h"
#import "SerializedPlatformRepresentationMac.h"
@@ -1090,11 +1091,8 @@
for (NSValue *thisRangeValue in m_cachedLoadedRanges.get()) {
CMTimeRange timeRange = [thisRangeValue CMTimeRangeValue];
- if (CMTIMERANGE_IS_VALID(timeRange) && !CMTIMERANGE_IS_EMPTY(timeRange)) {
- float rangeStart = narrowPrecisionToFloat(CMTimeGetSeconds(timeRange.start));
- float rangeEnd = narrowPrecisionToFloat(CMTimeGetSeconds(CMTimeRangeGetEnd(timeRange)));
- timeRanges->add(rangeStart, rangeEnd);
- }
+ if (CMTIMERANGE_IS_VALID(timeRange) && !CMTIMERANGE_IS_EMPTY(timeRange))
+ timeRanges->add(toMediaTime(timeRange.start), toMediaTime(CMTimeRangeGetEnd(timeRange)));
}
return timeRanges;
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-06-03 21:09:07 UTC (rev 169568)
@@ -464,7 +464,7 @@
std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateMediaSourceAVFObjC::seekable() const
{
- return PlatformTimeRanges::create(minTimeSeekable(), maxTimeSeekableDouble());
+ return PlatformTimeRanges::create(MediaTime::createWithDouble(minTimeSeekable()), MediaTime::createWithDouble(maxTimeSeekableDouble()));
}
double MediaPlayerPrivateMediaSourceAVFObjC::maxTimeSeekableDouble() const
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -865,21 +865,21 @@
for (guint index = 0; index < gst_query_get_n_buffering_ranges(query); index++) {
gint64 rangeStart = 0, rangeStop = 0;
if (gst_query_parse_nth_buffering_range(query, index, &rangeStart, &rangeStop))
- timeRanges->add(static_cast<float>((rangeStart * mediaDuration) / GST_FORMAT_PERCENT_MAX),
- static_cast<float>((rangeStop * mediaDuration) / GST_FORMAT_PERCENT_MAX));
+ timeRanges->add(MediaTime::createWithDouble((rangeStart * mediaDuration) / GST_FORMAT_PERCENT_MAX),
+ MediaTime::createWithDouble((rangeStop * mediaDuration) / GST_FORMAT_PERCENT_MAX));
}
// Fallback to the more general maxTimeLoaded() if no range has
// been found.
if (!timeRanges->length())
if (float loaded = maxTimeLoaded())
- timeRanges->add(0, loaded);
+ timeRanges->add(MediaTime::zeroTime(), MediaTime::createWithDouble(loaded));
gst_query_unref(query);
#else
float loaded = maxTimeLoaded();
if (!m_errorOccured && !isLiveStream() && loaded > 0)
- timeRanges->add(0, loaded);
+ timeRanges->add(MediaTime::zeroTime(), MediaTime::createWithDouble(loaded));
#endif
return timeRanges;
}
Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (169567 => 169568)
--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2014-06-03 21:09:07 UTC (rev 169568)
@@ -922,7 +922,7 @@
auto timeRanges = PlatformTimeRanges::create();
float loaded = maxTimeLoaded();
if (loaded > 0)
- timeRanges->add(0, loaded);
+ timeRanges->add(MediaTime::zeroTime(), MediaTime::createWithDouble(loaded));
return timeRanges;
}
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp (169567 => 169568)
--- trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2014-06-03 20:59:04 UTC (rev 169567)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2014-06-03 21:09:07 UTC (rev 169568)
@@ -216,12 +216,12 @@
return;
auto buffered = m_mediaSource->buffered();
- size_t pos = buffered->find(m_currentTime.toDouble());
+ size_t pos = buffered->find(m_currentTime);
if (pos == notFound)
return;
bool ignoreError;
- m_currentTime = std::min(m_duration, MediaTime::createWithDouble(buffered->end(pos, ignoreError)));
+ m_currentTime = std::min(m_duration, buffered->end(pos, ignoreError));
m_player->timeChanged();
}