Bug 1282410 - part3 : add log. draft
authorAlastor Wu <alwu@mozilla.com>
Fri, 01 Jul 2016 14:47:45 +0800
changeset 383095 857fef4f676a6b31118fe318a90e54916c9ae669
parent 383094 07765a74be3eafb8746da73717e118f903b131e3
child 524387 55217d4fda7abf9bb9fe2c2e2b95302dd0184e62
push id21928
push useralwu@mozilla.com
push dateFri, 01 Jul 2016 06:47:00 +0000
bugs1282410
milestone50.0a1
Bug 1282410 - part3 : add log. MozReview-Commit-ID: KWf3uya31zv
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3027,52 +3027,50 @@ nsresult HTMLMediaElement::InitializeDec
 }
 
 nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
                                                        nsIStreamListener** aListener)
 {
   NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
   NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
 
-  nsAutoCString mimeType;
-
-  aChannel->GetContentType(mimeType);
-  NS_ASSERTION(!mimeType.IsEmpty(), "We should have the Content-Type.");
+  aChannel->GetContentType(mMimeType);
+  NS_ASSERTION(!mMimeType.IsEmpty(), "We should have the Content-Type.");
 
   DecoderDoctorDiagnostics diagnostics;
   RefPtr<MediaDecoder> decoder =
-    DecoderTraits::CreateDecoder(mimeType, this, &diagnostics);
+    DecoderTraits::CreateDecoder(mMimeType, this, &diagnostics);
   diagnostics.StoreFormatDiagnostics(OwnerDoc(),
-                                     NS_ConvertASCIItoUTF16(mimeType),
+                                     NS_ConvertASCIItoUTF16(mMimeType),
                                      decoder != nullptr,
                                      __func__);
   if (!decoder) {
     nsAutoString src;
     GetCurrentSrc(src);
-    NS_ConvertUTF8toUTF16 mimeUTF16(mimeType);
+    NS_ConvertUTF8toUTF16 mimeUTF16(mMimeType);
     const char16_t* params[] = { mimeUTF16.get(), src.get() };
     ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params));
     return NS_ERROR_FAILURE;
   }
 
-  LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get()));
+  LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mMimeType.get()));
 
   RefPtr<MediaResource> resource =
     MediaResource::Create(decoder->GetResourceCallback(), aChannel);
 
   if (!resource)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // stream successfully created, the stream now owns the channel.
   mChannel = nullptr;
 
   // We postpone the |FinishDecoderSetup| function call until we get
   // |OnConnected| signal from MediaStreamController which is held by
   // RtspMediaResource.
-  if (DecoderTraits::DecoderWaitsForOnConnected(mimeType)) {
+  if (DecoderTraits::DecoderWaitsForOnConnected(mMimeType)) {
     decoder->SetResource(resource);
     SetDecoder(decoder);
     if (aListener) {
       *aListener = nullptr;
     }
     return NS_OK;
   } else {
     return FinishDecoderSetup(decoder, resource, aListener);
@@ -5751,16 +5749,18 @@ HTMLMediaElement::OpenUnsupportedMediaWi
     return;
   }
 
   // If media doesn't start playing, we don't need to open it.
   if (mPaused) {
     return;
   }
 
+  LOG(LogLevel::Debug, ("Open unsupported type \'%s\' with external apps.",
+      mMimeType.get()));
   nsContentUtils::DispatchTrustedEvent(OwnerDoc(), static_cast<nsIContent*>(this),
                                        NS_LITERAL_STRING("OpenMediaWithExtenalApp"),
                                        true,
                                        true);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -1628,14 +1628,16 @@ private:
   // be seeked even before the media is loaded.
   double mDefaultPlaybackStartPosition;
 
   // True if the audio track is not silent.
   bool mIsAudioTrackAudible;
 
   // True if media element is audible for users.
   bool mAudible;
+
+  nsAutoCString mMimeType;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_HTMLMediaElement_h