Bug 1550633 - part3 : add debug log to show track's kind. r=jya
☠☠ backed out by 6acae89335b0 ☠ ☠
authoralwu <alwu@mozilla.com>
Thu, 23 May 2019 09:05:00 +0000
changeset 475252 b15cc6e689e79f87439d0163e7f7bb1964ad23bc
parent 475251 be178934cbbba786670417e9a1090713cc4ebc05
child 475253 def294ad0efb614102f890e85b5b8f9c1e0cf2d7
push id36058
push useraciure@mozilla.com
push dateFri, 24 May 2019 03:53:25 +0000
treeherdermozilla-central@c87317c41902 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1550633
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550633 - part3 : add debug log to show track's kind. r=jya Showing track's kind in debug log is helpful. Differential Revision: https://phabricator.services.mozilla.com/D31373
dom/media/TextTrack.cpp
--- a/dom/media/TextTrack.cpp
+++ b/dom/media/TextTrack.cpp
@@ -49,16 +49,34 @@ static const char* ToReadyStateStr(const
     case TextTrackReadyState::FailedToLoad:
       return "FailedToLoad";
     default:
       MOZ_ASSERT_UNREACHABLE("Invalid state.");
   }
   return "Unknown";
 }
 
+static const char* ToTextTrackKindStr(const TextTrackKind aKind) {
+  switch (aKind) {
+    case TextTrackKind::Subtitles:
+      return "Subtitles";
+    case TextTrackKind::Captions:
+      return "Captions";
+    case TextTrackKind::Descriptions:
+      return "Descriptions";
+    case TextTrackKind::Chapters:
+      return "Chapters";
+    case TextTrackKind::Metadata:
+      return "Metadata";
+    default:
+      MOZ_ASSERT_UNREACHABLE("Invalid kind.");
+  }
+  return "Unknown";
+}
+
 NS_IMPL_CYCLE_COLLECTION_INHERITED(TextTrack, DOMEventTargetHelper, mCueList,
                                    mActiveCueList, mTextTrackList,
                                    mTrackElement)
 
 NS_IMPL_ADDREF_INHERITED(TextTrack, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(TextTrack, DOMEventTargetHelper)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrack)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
@@ -107,17 +125,18 @@ JSObject* TextTrack::WrapObject(JSContex
                                 JS::Handle<JSObject*> aGivenProto) {
   return TextTrack_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 void TextTrack::SetMode(TextTrackMode aValue) {
   if (mMode == aValue) {
     return;
   }
-  WEBVTT_LOG("Set mode=%s", ToStateStr(aValue));
+  WEBVTT_LOG("Set mode=%s for track kind %s", ToStateStr(aValue),
+             ToTextTrackKindStr(mKind));
   mMode = aValue;
 
   HTMLMediaElement* mediaElement = GetMediaElement();
   if (aValue == TextTrackMode::Disabled) {
     for (size_t i = 0; i < mCueList->Length() && mediaElement; ++i) {
       mediaElement->NotifyCueRemoved(*(*mCueList)[i]);
     }
     SetCuesInactive();