Bug 1394656 - Don't include nsAlgorithm.h in AudioSampleFormat.h. r?jwwang draft
authorChris Pearce <cpearce@mozilla.com>
Tue, 29 Aug 2017 11:07:09 +1200
changeset 654653 3b321db0b68033752e2387c3ffe3c1b803fe34dc
parent 654398 3529b653ede26f990eb7320649015294ad0f8e76
child 654654 c856befc4acf5a93e2c292a607662d4781dd3847
push id76631
push userbmo:cpearce@mozilla.com
push dateTue, 29 Aug 2017 03:05:23 +0000
reviewersjwwang
bugs1394656
milestone57.0a1
Bug 1394656 - Don't include nsAlgorithm.h in AudioSampleFormat.h. r?jwwang There's nothing in nsAlgorithm.h that we're using in AudioSampleFormat.h, though it does pull in the definition of NS_ASSERTION(), which we can replace with an MFBT assertion to simplyfy the include graph. MozReview-Commit-ID: EXOv2t0hKDc
dom/media/AudioSampleFormat.h
--- a/dom/media/AudioSampleFormat.h
+++ b/dom/media/AudioSampleFormat.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef MOZILLA_AUDIOSAMPLEFORMAT_H_
 #define MOZILLA_AUDIOSAMPLEFORMAT_H_
 
-#include "nsAlgorithm.h"
+#include "mozilla/Assertions.h"
 #include <algorithm>
 
 namespace mozilla {
 
 /**
  * Audio formats supported in MediaStreams and media elements.
  *
  * Only one of these is supported by AudioStream, and that is determined
@@ -243,17 +243,16 @@ ScaleAudioSamples(short* aBuffer, int aC
 }
 
 inline const void*
 AddAudioSampleOffset(const void* aBase, AudioSampleFormat aFormat,
                      int32_t aOffset)
 {
   static_assert(AUDIO_FORMAT_S16 == 0, "Bad constant");
   static_assert(AUDIO_FORMAT_FLOAT32 == 1, "Bad constant");
-  NS_ASSERTION(aFormat == AUDIO_FORMAT_S16 || aFormat == AUDIO_FORMAT_FLOAT32,
-               "Unknown format");
+  MOZ_ASSERT(aFormat == AUDIO_FORMAT_S16 || aFormat == AUDIO_FORMAT_FLOAT32);
 
   return static_cast<const uint8_t*>(aBase) + (aFormat + 1)*2*aOffset;
 }
 
 } // namespace mozilla
 
 #endif /* MOZILLA_AUDIOSAMPLEFORMAT_H_ */