Bug 1253959 - Per comment 10, #ifdef code that causes ReadMetadata() to fail on Windows XP debug. r=cpearce, a=lizzard
authorJW Wang <jwwang@mozilla.com>
Mon, 07 Mar 2016 16:07:14 +0800
changeset 323413 5cf762adb7a53da098807d3e34fd8cf461ec361a
parent 323412 e20a701d730dd3b218adfc62abdf8caf2f8dc937
child 323414 7b336616b282aecc487e3ccb785fd67b88eea0b9
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lizzard
bugs1253959
milestone47.0a2
Bug 1253959 - Per comment 10, #ifdef code that causes ReadMetadata() to fail on Windows XP debug. r=cpearce, a=lizzard MozReview-Commit-ID: J6Muv6pJJhf
dom/media/directshow/DirectShowReader.cpp
dom/media/directshow/DirectShowReader.h
--- a/dom/media/directshow/DirectShowReader.cpp
+++ b/dom/media/directshow/DirectShowReader.cpp
@@ -23,33 +23,33 @@ GetDirectShowLog() {
   return log;
 }
 
 #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
 
 DirectShowReader::DirectShowReader(AbstractMediaDecoder* aDecoder)
   : MediaDecoderReader(aDecoder),
     mMP3FrameParser(aDecoder->GetResource()->GetLength()),
-#ifdef DEBUG
+#ifdef DIRECTSHOW_REGISTER_GRAPH
     mRotRegister(0),
 #endif
     mNumChannels(0),
     mAudioRate(0),
     mBytesPerSample(0),
     mDuration(0)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
   MOZ_COUNT_CTOR(DirectShowReader);
 }
 
 DirectShowReader::~DirectShowReader()
 {
   MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
   MOZ_COUNT_DTOR(DirectShowReader);
-#ifdef DEBUG
+#ifdef DIRECTSHOW_REGISTER_GRAPH
   if (mRotRegister) {
     RemoveGraphFromRunningObjectTable(mRotRegister);
   }
 #endif
 }
 
 // Try to parse the MP3 stream to make sure this is indeed an MP3, get the
 // estimated duration of the stream, and find the offset of the actual MP3
@@ -99,21 +99,17 @@ DirectShowReader::ReadMetadata(MediaInfo
                         CLSCTX_INPROC_SERVER,
                         IID_IGraphBuilder,
                         reinterpret_cast<void**>(static_cast<IGraphBuilder**>(getter_AddRefs(mGraph))));
   NS_ENSURE_TRUE(SUCCEEDED(hr) && mGraph, NS_ERROR_FAILURE);
 
   rv = ParseMP3Headers(&mMP3FrameParser, mDecoder->GetResource());
   NS_ENSURE_SUCCESS(rv, rv);
 
-  #ifdef DEBUG
-  // Add the graph to the Running Object Table so that we can connect
-  // to this graph with GraphEdit/GraphStudio. Note: on Vista and up you must
-  // also regsvr32 proppage.dll from the Windows SDK.
-  // See: http://msdn.microsoft.com/en-us/library/ms787252(VS.85).aspx
+  #ifdef DIRECTSHOW_REGISTER_GRAPH
   hr = AddGraphToRunningObjectTable(mGraph, &mRotRegister);
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
   #endif
 
   // Extract the interface pointers we'll need from the filter graph.
   hr = mGraph->QueryInterface(static_cast<IMediaControl**>(getter_AddRefs(mControl)));
   NS_ENSURE_TRUE(SUCCEEDED(hr) && mControl, NS_ERROR_FAILURE);
 
--- a/dom/media/directshow/DirectShowReader.h
+++ b/dom/media/directshow/DirectShowReader.h
@@ -8,16 +8,22 @@
 #define DirectShowReader_h_
 
 #include "windows.h" // HRESULT, DWORD
 #include "MediaDecoderReader.h"
 #include "MediaResource.h"
 #include "mozilla/RefPtr.h"
 #include "MP3FrameParser.h"
 
+// Add the graph to the Running Object Table so that we can connect
+// to this graph with GraphEdit/GraphStudio. Note: on Vista and up you must
+// also regsvr32 proppage.dll from the Windows SDK.
+// See: http://msdn.microsoft.com/en-us/library/ms787252(VS.85).aspx
+// #define DIRECTSHOW_REGISTER_GRAPH
+
 struct IGraphBuilder;
 struct IMediaControl;
 struct IMediaSeeking;
 
 namespace mozilla {
 
 class AudioSinkFilter;
 class SourceFilter;
@@ -78,17 +84,17 @@ private:
   // The graph will block while this is blocked, i.e. it will pause decoding.
   RefPtr<AudioSinkFilter> mAudioSinkFilter;
 
   // Some MP3s are variable bitrate, so DirectShow's duration estimation
   // can make its duration estimation based on the wrong bitrate. So we parse
   // the MP3 frames to get a more accuate estimate of the duration.
   MP3FrameParser mMP3FrameParser;
 
-#ifdef DEBUG
+#ifdef DIRECTSHOW_REGISTER_GRAPH
   // Used to add/remove the filter graph to the Running Object Table. You can
   // connect GraphEdit/GraphStudio to the graph to observe and/or debug its
   // topology and state.
   DWORD mRotRegister;
 #endif
 
   // Number of channels in the audio stream.
   uint32_t mNumChannels;