WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-145676-20150621011144.patch (text/plain), 15.05 KB, created by
Matthew Daiter
on 2015-06-21 01:12:25 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Matthew Daiter
Created:
2015-06-21 01:12:25 PDT
Size:
15.05 KB
patch
obsolete
>Index: ChangeLog >=================================================================== >--- ChangeLog (revision 185804) >+++ ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2015-06-21 Matthew Daiter <mdaiter@apple.com> >+ >+ Added getStartDate() support to WebKit. Allows HLS streams to >+ define when they had been originally streamed, so that services >+ using them could inform users about the original date, etc. >+ >+ https://bugs.webkit.org/show_bug.cgi?id=145676 >+ <rdar://problem/20876076> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKitBuild: Added. >+ * WebKitBuild/Debug: Added. >+ * WebKitBuild/Debug/DerivedSources: Added. >+ * WebKitBuild/Debug/DerivedSources/WebCore: Added. >+ > 2015-06-20 Michael Catanzaro <mcatanzaro@igalia.com> > > [EFL][GTK] Define GLIB_VERSION_MIN_REQUIRED and require glib 2.36 for GTK >Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 185804) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,46 @@ >+2015-06-21 Matthew Daiter <mdaiter@apple.com> >+ >+ Added getStartDate() support to WebKit. Allows HLS streams to define >+ when they had been originally streamed, so that services using them >+ could inform users about the original date, etc. >+ https://bugs.webkit.org/show_bug.cgi?id=145676 >+ <rdar://problem/20876076> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: http/tests/media/hls/video-controller-getStartDate.html >+ >+ * bindings/js/JSDOMBinding.cpp: >+ (WebCore::valueToStringWithUndefinedOrNullCheck): >+ (WebCore::jsDateOrNaN): >+ (WebCore::jsDateOrNull): >+ * bindings/js/JSDOMBinding.h: >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (NativeToJSValue): >+ * bindings/scripts/IDLAttributes.txt: >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::canPlayType): >+ (WebCore::HTMLMediaElement::getStartDate): >+ (WebCore::HTMLMediaElement::load): >+ * html/HTMLMediaElement.h: >+ * html/HTMLMediaElement.idl: >+ * platform/graphics/MediaPlayer.cpp: >+ (WebCore::MediaPlayer::currentTime): >+ (WebCore::MediaPlayer::getStartDate): >+ (WebCore::MediaPlayer::seekWithTolerance): >+ * platform/graphics/MediaPlayer.h: >+ * platform/graphics/MediaPlayerPrivate.h: >+ (WebCore::MediaPlayerPrivateInterface::currentTimeDouble): >+ (WebCore::MediaPlayerPrivateInterface::currentMediaTime): >+ (WebCore::MediaPlayerPrivateInterface::getStartDate): >+ (WebCore::MediaPlayerPrivateInterface::seek): >+ (WebCore::MediaPlayerPrivateInterface::seekDouble): >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate): >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame): >+ > 2015-06-20 Tim Horton <timothy_horton@apple.com> > > Deselection of text causes a noticeable jump on force touch machines >Index: Source/WebCore/bindings/js/JSDOMBinding.cpp >=================================================================== >--- Source/WebCore/bindings/js/JSDOMBinding.cpp (revision 185804) >+++ Source/WebCore/bindings/js/JSDOMBinding.cpp (working copy) >@@ -113,6 +113,13 @@ String valueToStringWithUndefinedOrNullC > return value.toString(exec)->value(exec); > } > >+JSValue jsDateOrNaN(ExecState* exec, double value) >+{ >+ if (std::isnan(value)) >+ return jsDoubleNumber(value); >+ return jsDateOrNull(exec, value); >+} >+ > JSValue jsDateOrNull(ExecState* exec, double value) > { > if (!std::isfinite(value)) >Index: Source/WebCore/bindings/js/JSDOMBinding.h >=================================================================== >--- Source/WebCore/bindings/js/JSDOMBinding.h (revision 185804) >+++ Source/WebCore/bindings/js/JSDOMBinding.h (working copy) >@@ -314,6 +314,8 @@ inline uint32_t toUInt32(JSC::ExecState* > WEBCORE_EXPORT int64_t toInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration); > WEBCORE_EXPORT uint64_t toUInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration); > >+// Returns a Date instnace for the specified value, or NaN if the date is not a number. >+JSC::JSValue jsDateOrNaN(JSC::ExecState*, double); > // Returns a Date instance for the specified value, or null if the value is NaN or infinity. > JSC::JSValue jsDateOrNull(JSC::ExecState*, double); > // NaN if the value can't be converted to a date. >Index: Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >=================================================================== >--- Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (revision 185804) >+++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (working copy) >@@ -3934,6 +3934,13 @@ sub NativeToJSValue > > # Need to check Date type before IsPrimitiveType(). > if ($type eq "Date") { >+ my $conv = $signature->extendedAttributes->{"TreatReturnedNaNDateAs"}; >+ if (defined $conv) { >+ return "jsDateOrNull(exec, $value)" if $conv eq "Null"; >+ return "jsDateOrNaN(exec, $value)" if $conv eq "NaN"; >+ >+ die "Unknown value for TreatReturnedNaNDateAs extended attribute"; >+ } > return "jsDateOrNull(exec, $value)"; > } > >Index: Source/WebCore/bindings/scripts/IDLAttributes.txt >=================================================================== >--- Source/WebCore/bindings/scripts/IDLAttributes.txt (revision 185804) >+++ Source/WebCore/bindings/scripts/IDLAttributes.txt (working copy) >@@ -111,6 +111,7 @@ SkipVTableValidation > StrictTypeChecking > SuppressToJSObject > TreatNullAs=NullString >+TreatReturnedNaNDateAs=Null|NaN > TreatReturnedNullStringAs=Null|Undefined > TreatUndefinedAs=NullString > TypedArray=* >Index: Source/WebCore/html/HTMLMediaElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.cpp (revision 185804) >+++ Source/WebCore/html/HTMLMediaElement.cpp (working copy) >@@ -875,6 +875,11 @@ String HTMLMediaElement::canPlayType(con > return canPlay; > } > >+double HTMLMediaElement::getStartDate() const >+{ >+ return m_player->getStartDate().toDouble(); >+} >+ > void HTMLMediaElement::load() > { > Ref<HTMLMediaElement> protect(*this); // loadInternal may result in a 'beforeload' event, which can make arbitrary DOM mutations. >Index: Source/WebCore/html/HTMLMediaElement.h >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.h (revision 185804) >+++ Source/WebCore/html/HTMLMediaElement.h (working copy) >@@ -178,6 +178,7 @@ public: > WEBCORE_EXPORT virtual double currentTime() const override; > virtual void setCurrentTime(double) override; > virtual void setCurrentTime(double, ExceptionCode&); >+ virtual double getStartDate() const; > WEBCORE_EXPORT virtual double duration() const override; > WEBCORE_EXPORT virtual bool paused() const override; > virtual double defaultPlaybackRate() const override; >Index: Source/WebCore/html/HTMLMediaElement.idl >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.idl (revision 185804) >+++ Source/WebCore/html/HTMLMediaElement.idl (working copy) >@@ -65,6 +65,7 @@ > // playback state > [SetterRaisesException] attribute unrestricted double currentTime; > readonly attribute unrestricted double duration; >+ [TreatReturnedNaNDateAs=NaN] Date getStartDate(); > readonly attribute boolean paused; > attribute unrestricted double defaultPlaybackRate; > attribute unrestricted double playbackRate; >Index: Source/WebCore/platform/graphics/MediaPlayer.cpp >=================================================================== >--- Source/WebCore/platform/graphics/MediaPlayer.cpp (revision 185804) >+++ Source/WebCore/platform/graphics/MediaPlayer.cpp (working copy) >@@ -534,6 +534,11 @@ MediaTime MediaPlayer::currentTime() con > return m_private->currentMediaTime(); > } > >+MediaTime MediaPlayer::getStartDate() const >+{ >+ return m_private->getStartDate(); >+} >+ > void MediaPlayer::seekWithTolerance(const MediaTime& time, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance) > { > m_private->seekWithTolerance(time, negativeTolerance, positiveTolerance); >Index: Source/WebCore/platform/graphics/MediaPlayer.h >=================================================================== >--- Source/WebCore/platform/graphics/MediaPlayer.h (revision 185804) >+++ Source/WebCore/platform/graphics/MediaPlayer.h (working copy) >@@ -380,6 +380,8 @@ public: > MediaTime startTime() const; > MediaTime initialTime() const; > >+ MediaTime getStartDate() const; >+ > double rate() const; > void setRate(double); > double requestedRate() const; >Index: Source/WebCore/platform/graphics/MediaPlayerPrivate.h >=================================================================== >--- Source/WebCore/platform/graphics/MediaPlayerPrivate.h (revision 185804) >+++ Source/WebCore/platform/graphics/MediaPlayerPrivate.h (working copy) >@@ -94,6 +94,8 @@ public: > virtual double currentTimeDouble() const { return currentTime(); } > virtual MediaTime currentMediaTime() const { return MediaTime::createWithDouble(currentTimeDouble()); } > >+ virtual MediaTime getStartDate() const { return MediaTime::createWithDouble(std::numeric_limits<double>::quiet_NaN()); } >+ > virtual void seek(float) { } > virtual void seekDouble(double time) { seek(time); } > virtual void seek(const MediaTime& time) { seekDouble(time.toDouble()); } >Index: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >=================================================================== >--- Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (revision 185804) >+++ Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (working copy) >@@ -206,6 +206,8 @@ private: > virtual void updateVideoLayerGravity() override; > > virtual bool hasSingleSecurityOrigin() const; >+ >+ MediaTime getStartDate() const override; > > #if ENABLE(VIDEO_TRACK) > virtual bool requiresTextTrackRepresentation() const override; >Index: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >=================================================================== >--- Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (revision 185804) >+++ Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (working copy) >@@ -719,6 +719,21 @@ void MediaPlayerPrivateAVFoundationObjC: > m_videoLayer = nil; > } > >+MediaTime MediaPlayerPrivateAVFoundationObjC::getStartDate() const >+{ >+ // Date changes as the track's playback position changes. Must subtract currentTime (offset in seconds) from date offset to get date beginning >+ double date = [[m_avPlayerItem currentDate] timeIntervalSince1970] * 1000; >+ >+ // No live streams were made during the epoch (1970). AVFoundation returns 0 if the media file doesn't have a start date >+ if (!date) >+ return MediaTime::invalidTime(); >+ >+ double currentTime = CMTimeGetSeconds([m_avPlayerItem currentTime]) * 1000; >+ >+ // Rounding due to second offset error when subtracting. >+ return MediaTime::createWithDouble(round(date - currentTime)); >+} >+ > bool MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame() const > { > if (currentRenderingMode() == MediaRenderingToLayer) >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 185804) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2015-06-21 Matthew Daiter <mdaiter@apple.com> >+ >+ Added tests for video controller >+ https://bugs.webkit.org/show_bug.cgi?id=145676 >+ <rdar://problem/21252512> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/media/hls/video-controller-getStartDate-expected.txt: Added. >+ * http/tests/media/hls/video-controller-getStartDate.html: Added. >+ * http/tests/media/resources/hls/test-vid-date-time.m3u8: Added. >+ > 2015-06-20 David Kilzer <ddkilzer@apple.com> > > REGRESSION (r185779): fast/canvas/{canvas-toDataURL-crash,pattern-too-large-to-create}.html are broken >Index: LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt >=================================================================== >--- LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt (revision 0) >+++ LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt (working copy) >@@ -0,0 +1,9 @@ >+ >+Test that getStartDate() returns appropriate NaN or date. >+ >+EVENT(canplaythrough) >+EVENT(canplaythrough) >+EXPECTED (isNaN(video.getStartDate()) == 'true') OK >+EXPECTED (video.getStartDate() == 'Wed Nov 03 2010 01:00:00 GMT-0700 (PDT)') OK >+END OF TEST >+ >Index: LayoutTests/http/tests/media/hls/video-controller-getStartDate.html >=================================================================== >--- LayoutTests/http/tests/media/hls/video-controller-getStartDate.html (revision 0) >+++ LayoutTests/http/tests/media/hls/video-controller-getStartDate.html (working copy) >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <script src=../../media-resources/media-file.js></script> >+ <script src=../../media-resources/video-test.js></script> >+ <script> >+ var canPlayThroughCount = 0; >+ >+ function canPlayThrough() >+ { >+ consoleWrite("EVENT(canplaythrough)"); >+ if (++canPlayThroughCount == 2) >+ testGetStartDate() >+ } >+ >+ function start() >+ { >+ findMediaElement(); >+ >+ video = document.getElementById("source_without_start_date"); >+ video.src = "../resources/hls/test-vod.m3u8"; >+ video.addEventListener('canplaythrough', canPlayThrough, true); >+ >+ video = document.getElementById('source_with_start_date'); >+ video.src = "../resources/hls/test-vod-date-time.m3u8"; >+ video.addEventListener('canplaythrough', canPlayThrough, true); >+ } >+ >+ function testGetStartDate() >+ { >+ video = document.getElementById("source_without_start_date"); >+ testExpected("isNaN(video.getStartDate())", true ); >+ >+ video = document.getElementById('source_with_start_date'); >+ testExpected("video.getStartDate()", "Wed Nov 03 2010 01:00:00 GMT-0700 (PDT)"); >+ >+ endTest(); >+ } >+ </script> >+ </head> >+ <body onload="start()"> >+ <video id="source_with_start_date" autoplay="autoplay" width="640" height="480"></video> >+ <video id="source_without_start_date" autoplay="autoplay" width="640" height="480"></video> >+ <p>Test that getStartDate() returns appropriate NaN or date.</p> >+ </body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 145676
:
254320
|
254326
|
254328
|
254383
|
254400
|
254401
|
254515
|
254516
|
254519
|
254523
|
254524
|
254529
|
254530
|
254582
|
254584
|
254588
|
255220
|
255234
|
255315
|
255319
|
255320
|
255529
|
255533
|
255535
|
255669
|
255670
|
255671
|
255673
|
255677