WebKit Bugzilla
Attachment 339588 Details for
Bug 185321
: Log media time range as JSON
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185321-20180504134007.patch (text/plain), 8.50 KB, created by
Eric Carlson
on 2018-05-04 13:40:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2018-05-04 13:40:08 PDT
Size:
8.50 KB
patch
obsolete
>Subversion Revision: 231264 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index b29d96dd604c51399e8e271d14fc766837eeb86e..2391b54cdf26f3c37ec71f01a0b76d39a58f41ee 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-04 Eric Carlson <eric.carlson@apple.com> >+ >+ Log media time range as JSON >+ https://bugs.webkit.org/show_bug.cgi?id=185321 >+ <rdar://problem/39986746> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/MediaTime.cpp: >+ (WTF::toJSONStringInternal): Extract guts of MediaTime::toJSONString to this static function >+ so it can be used by MediaTimeRange::toJSONString as well. >+ (WTF::MediaTime::toJSONString const): >+ (WTF::MediaTimeRange::toJSONString const): >+ * wtf/MediaTime.h: >+ > 2018-05-02 Jonathan Bedard <jbedard@apple.com> > > Follow-up build fix for r231223 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c0072473c1e81470275b8c32981df03d5ddfaf3b..b72402bb5f74ce5aa46368b14051a3837131b3ec 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-05-04 Eric Carlson <eric.carlson@apple.com> >+ >+ Log media time range as JSON >+ https://bugs.webkit.org/show_bug.cgi?id=185321 >+ <rdar://problem/39986746> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests, tested manually. >+ >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::addPlayedRange): Log as time range. >+ (WebCore::HTMLMediaElement::visibilityStateChanged): Cleanup. >+ >+ * platform/graphics/MediaPlayer.h: >+ (WTF::LogArgument<MediaTime>::toString): >+ (WTF::LogArgument<MediaTimeRange>::toString): >+ >+ * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: >+ (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Log error as time range. >+ > 2018-05-02 Youenn Fablet <youenn@apple.com> > > Use NetworkLoadChecker for navigation loads >diff --git a/Source/WTF/wtf/MediaTime.cpp b/Source/WTF/wtf/MediaTime.cpp >index 03050b5264368c67dbc5e0b84e57482f04d3d4a2..9a28ab0e29b26552494e72ac581ae3077bcfa521 100644 >--- a/Source/WTF/wtf/MediaTime.cpp >+++ b/Source/WTF/wtf/MediaTime.cpp >@@ -577,28 +577,33 @@ String MediaTime::toString() const > return builder.toString(); > } > >-String MediaTime::toJSONString() const >+static Ref<JSON::Object> toJSONStringInternal(const MediaTime& time) > { > auto object = JSON::Object::create(); > >- if (hasDoubleValue()) >- object->setDouble(ASCIILiteral("value"), toDouble()); >+ if (time.hasDoubleValue()) >+ object->setDouble(ASCIILiteral("value"), time.toDouble()); > else { >- if (isInvalid() || isIndefinite()) >+ if (time.isInvalid() || time.isIndefinite()) > object->setString(ASCIILiteral("value"), ASCIILiteral("NaN")); >- else if (isPositiveInfinite()) >+ else if (time.isPositiveInfinite()) > object->setString(ASCIILiteral("value"), ASCIILiteral("POSITIVE_INFINITY")); >- else if (isNegativeInfinite()) >+ else if (time.isNegativeInfinite()) > object->setString(ASCIILiteral("value"), ASCIILiteral("NEGATIVE_INFINITY")); > else >- object->setDouble(ASCIILiteral("value"), toDouble()); >+ object->setDouble(ASCIILiteral("value"), time.toDouble()); > >- object->setInteger(ASCIILiteral("numerator"), static_cast<int>(m_timeValue)); >- object->setInteger(ASCIILiteral("denominator"), m_timeScale); >- object->setInteger(ASCIILiteral("flags"), m_timeFlags); >+ object->setInteger(ASCIILiteral("numerator"), static_cast<int>(time.timeValue())); >+ object->setInteger(ASCIILiteral("denominator"), time.timeScale()); >+ object->setInteger(ASCIILiteral("flags"), time.timeFlags()); > } > >- return object->toJSONString(); >+ return object; >+} >+ >+String MediaTime::toJSONString() const >+{ >+ return toJSONStringInternal(*this)->toJSONString(); > } > > MediaTime abs(const MediaTime& rhs) >@@ -615,5 +620,14 @@ MediaTime abs(const MediaTime& rhs) > return val; > } > >+String MediaTimeRange::toJSONString() const >+{ >+ auto object = JSON::Object::create(); >+ >+ object->setObject(ASCIILiteral("start"), toJSONStringInternal(start)); >+ object->setObject(ASCIILiteral("end"), toJSONStringInternal(end)); >+ >+ return object->toJSONString(); > } > >+} >diff --git a/Source/WTF/wtf/MediaTime.h b/Source/WTF/wtf/MediaTime.h >index 337fefed9c2f696ace787c189d7365c4a6aec9cc..4aded379bea3d579129a550a82f4cbc04e17f0b7 100644 >--- a/Source/WTF/wtf/MediaTime.h >+++ b/Source/WTF/wtf/MediaTime.h >@@ -98,6 +98,7 @@ public: > bool isNegativeInfinite() const { return m_timeFlags & NegativeInfinite; } > bool isIndefinite() const { return m_timeFlags & Indefinite; } > bool hasDoubleValue() const { return m_timeFlags & DoubleValue; } >+ uint8_t timeFlags() const { return m_timeFlags; } > > static const MediaTime& zeroTime(); > static const MediaTime& invalidTime(); >@@ -151,6 +152,13 @@ inline MediaTime operator*(int32_t lhs, const MediaTime& rhs) { return rhs.opera > > WTF_EXPORT_PRIVATE extern MediaTime abs(const MediaTime& rhs); > >+struct WTF_EXPORT_PRIVATE MediaTimeRange { >+ String toJSONString() const; >+ >+ const MediaTime start; >+ const MediaTime end; >+}; >+ > template<class Encoder> > void MediaTime::encode(Encoder& encoder) const > { >@@ -168,6 +176,7 @@ bool MediaTime::decode(Decoder& decoder, MediaTime& time) > } > > using WTF::MediaTime; >+using WTF::MediaTimeRange; > using WTF::abs; > > #endif >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 521fca2e33ebfcbda781e313813fb9d241de1ca5..9078ae50268ed019f6fe688aac4c72fac6e9ca47 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -2842,7 +2842,7 @@ void HTMLMediaElement::returnToRealtime() > > void HTMLMediaElement::addPlayedRange(const MediaTime& start, const MediaTime& end) > { >- DEBUG_LOG(LOGIDENTIFIER, "[", start, ", ", end, "]"); >+ DEBUG_LOG(LOGIDENTIFIER, MediaTimeRange { start, end }); > if (!m_playedTimeRanges) > m_playedTimeRanges = TimeRanges::create(); > m_playedTimeRanges->ranges().add(start, end); >@@ -5633,10 +5633,10 @@ void HTMLMediaElement::visibilityStateChanged() > bool isPlayingAudio = isPlaying() && hasAudio() && !muted() && volume(); > if (!isPlayingAudio) { > if (m_elementIsHidden) { >- ALWAYS_LOG(LOGIDENTIFIER, "visibilityStateChanged() Suspending playback after going to the background"); >+ ALWAYS_LOG(LOGIDENTIFIER, "Suspending playback after going to the background"); > m_mediaSession->beginInterruption(PlatformMediaSession::EnteringBackground); > } else { >- ALWAYS_LOG(LOGIDENTIFIER, "visibilityStateChanged() Resuming playback after entering foreground"); >+ ALWAYS_LOG(LOGIDENTIFIER, "Resuming playback after entering foreground"); > m_mediaSession->endInterruption(PlatformMediaSession::MayResumePlaying); > } > } >diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h >index c64ed9177207fb45bc8bb1e4a0b44bf7e35750ad..f6a1dc369ffe84cdf12ac37c52b5896def455a8a 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayer.h >+++ b/Source/WebCore/platform/graphics/MediaPlayer.h >@@ -694,9 +694,18 @@ template <> > struct LogArgument<MediaTime> { > static String toString(const MediaTime& time) > { >- return time.toString(); >+ return time.toJSONString(); > } > }; >+ >+template <> >+struct LogArgument<MediaTimeRange> { >+ static String toString(const MediaTimeRange& range) >+ { >+ return range.toJSONString(); >+ } >+}; >+ > } > > #endif // ENABLE(VIDEO) >diff --git a/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp b/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp >index 6f2b38725e5d408f6eb32fbf33b71f364bbfaee9..74c417a021872d29d34b10cf7faf6ec9c2eebb32 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp >+++ b/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp >@@ -383,7 +383,7 @@ void InbandTextTrackPrivateAVF::processAttributedStrings(CFArrayRef attributedSt > } > } > } else >- ERROR_LOG(LOGIDENTIFIER, "negative length cue(s): start ", m_currentCueStartTime, ", end ", m_currentCueEndTime); >+ ERROR_LOG(LOGIDENTIFIER, "negative length cue(s): ", MediaTimeRange { m_currentCueStartTime, m_currentCueEndTime }); > > removeCompletedCues(); > }
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 185321
: 339588