Bug 1153049: Part4. Remove redundant mHasAudio/mHasVideo member. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 14 Apr 2015 15:17:51 +1000
changeset 270341 8cde37caacefdc38a4929ce5fa5a7d7428477229
parent 270340 d6e188e8872e86f3fa4b514631e4e3e31442674e
child 270342 65492fe833627d14e292d63de5b8695011127c6f
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1153049
milestone40.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 1153049: Part4. Remove redundant mHasAudio/mHasVideo member. r=cpearce
dom/html/HTMLMediaElement.cpp
dom/media/MediaInfo.h
dom/media/android/AndroidMediaReader.cpp
dom/media/apple/AppleMP3Reader.cpp
dom/media/directshow/DirectShowReader.cpp
dom/media/fmp4/MP4Reader.cpp
dom/media/fmp4/apple/AppleVDADecoder.cpp
dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
dom/media/fmp4/wmf/WMFVideoMFTManager.cpp
dom/media/gstreamer/GStreamerReader.cpp
dom/media/ogg/OggReader.cpp
dom/media/omx/MediaCodecReader.cpp
dom/media/omx/MediaOmxReader.cpp
dom/media/raw/RawReader.cpp
dom/media/wave/WaveReader.cpp
dom/media/webm/WebMReader.cpp
dom/media/wmf/WMFReader.cpp
media/libstagefright/binding/DecoderData.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3504,25 +3504,23 @@ void HTMLMediaElement::UpdateReadyStateF
     return;
   }
 
   if (mSrcStream && mReadyState < nsIDOMHTMLMediaElement::HAVE_METADATA) {
     bool hasAudio = !AudioTracks()->IsEmpty();
     bool hasVideo = !VideoTracks()->IsEmpty();
 
     if ((!hasAudio && !hasVideo) ||
-        (IsVideo() && hasVideo && mMediaInfo.mVideo.mDisplay == nsIntSize(0, 0))) {
+        (IsVideo() && hasVideo && !HasVideo())) {
       return;
     }
 
     // We are playing a stream that has video and a video frame is now set.
     // This means we have all metadata needed to change ready state.
     MediaInfo mediaInfo = mMediaInfo;
-    mediaInfo.mAudio.mHasAudio = hasAudio;
-    mediaInfo.mVideo.mHasVideo = hasVideo;
     MetadataLoaded(&mediaInfo, nsAutoPtr<const MetadataTags>(nullptr));
   }
 
   if (aNextFrame == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING) {
     ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
     return;
   }
 
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -97,33 +97,27 @@ public:
 private:
   TrackType mType;
 };
 
 // Stores info relevant to presenting media frames.
 class VideoInfo : public TrackInfo {
 public:
   VideoInfo()
-    : VideoInfo(0, 0, false)
+    : VideoInfo(-1, -1)
   {
   }
 
   VideoInfo(int32_t aWidth, int32_t aHeight)
-    : VideoInfo(aWidth, aHeight, true)
-  {
-  }
-
-  VideoInfo(int32_t aWidth, int32_t aHeight, bool aHasVideo)
     : TrackInfo(kVideoTrack, NS_LITERAL_STRING("2"), NS_LITERAL_STRING("main"),
                 EmptyString(), EmptyString(), true, 2)
     , mDisplay(nsIntSize(aWidth, aHeight))
     , mStereoMode(StereoMode::MONO)
     , mImage(nsIntSize(aWidth, aHeight))
     , mExtraData(new DataBuffer)
-    , mHasVideo(aHasVideo)
   {
   }
 
   virtual bool IsValid() const override
   {
     return mDisplay.width > 0 && mDisplay.height > 0;
   }
 
@@ -133,34 +127,30 @@ public:
 
   // Indicates the frame layout for single track stereo videos.
   StereoMode mStereoMode;
 
   // Size in pixels of decoded video's image.
   nsIntSize mImage;
 
   nsRefPtr<DataBuffer> mExtraData;
-
-  // True if we have an active video bitstream.
-  bool mHasVideo;
 };
 
 class AudioInfo : public TrackInfo {
 public:
   AudioInfo()
     : TrackInfo(kAudioTrack, NS_LITERAL_STRING("1"), NS_LITERAL_STRING("main"),
                 EmptyString(), EmptyString(), true, 1)
     , mRate(0)
     , mChannels(0)
     , mBitDepth(0)
     , mProfile(0)
     , mExtendedProfile(0)
     , mCodecSpecificConfig(new DataBuffer)
     , mExtraData(new DataBuffer)
-    , mHasAudio(false)
   {
   }
 
   // Sample rate.
   uint32_t mRate;
 
   // Number of audio channels.
   uint32_t mChannels;
@@ -176,19 +166,16 @@ public:
 
   nsRefPtr<DataBuffer> mCodecSpecificConfig;
   nsRefPtr<DataBuffer> mExtraData;
 
   virtual bool IsValid() const override
   {
     return mChannels > 0 && mRate > 0;
   }
-
-  // True if we have an active audio bitstream.
-  bool mHasAudio;
 };
 
 class EncryptionInfo {
 public:
   struct InitData {
     template<typename AInitDatas>
     InitData(const nsAString& aType, AInitDatas&& aInitData)
       : mType(aType)
@@ -224,22 +211,22 @@ public:
   // One 'InitData' per encrypted buffer.
   InitDatas mInitDatas;
 };
 
 class MediaInfo {
 public:
   bool HasVideo() const
   {
-    return mVideo.mHasVideo;
+    return mVideo.IsValid();
   }
 
   bool HasAudio() const
   {
-    return mAudio.mHasAudio;
+    return mAudio.IsValid();
   }
 
   bool IsEncrypted() const
   {
     return mCrypto.IsEncrypted();
   }
 
   bool HasValidMedia() const
--- a/dom/media/android/AndroidMediaReader.cpp
+++ b/dom/media/android/AndroidMediaReader.cpp
@@ -69,32 +69,32 @@ nsresult AndroidMediaReader::ReadMetadat
     // that our video frame creation code doesn't overflow.
     nsIntSize displaySize(width, height);
     nsIntSize frameSize(width, height);
     if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
       return NS_ERROR_FAILURE;
     }
 
     // Video track's frame sizes will not overflow. Activate the video track.
-    mHasVideo = mInfo.mVideo.mHasVideo = true;
+    mHasVideo = true;
     mInfo.mVideo.mDisplay = displaySize;
     mPicture = pictureRect;
     mInitialFrame = frameSize;
     VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
     if (container) {
       container->SetCurrentFrame(gfxIntSize(displaySize.width, displaySize.height),
                                  nullptr,
                                  mozilla::TimeStamp::Now());
     }
   }
 
   if (mPlugin->HasAudio(mPlugin)) {
     int32_t numChannels, sampleRate;
     mPlugin->GetAudioParameters(mPlugin, &numChannels, &sampleRate);
-    mHasAudio = mInfo.mAudio.mHasAudio = true;
+    mHasAudio = true;
     mInfo.mAudio.mChannels = numChannels;
     mInfo.mAudio.mRate = sampleRate;
   }
 
  *aInfo = mInfo;
  *aTags = nullptr;
   return NS_OK;
 }
--- a/dom/media/apple/AppleMP3Reader.cpp
+++ b/dom/media/apple/AppleMP3Reader.cpp
@@ -409,19 +409,20 @@ AppleMP3Reader::ReadMetadata(MediaInfo* 
     return NS_ERROR_FAILURE;
   }
 
   if (!mMP3FrameParser.IsMP3()) {
     LOGE("Frame parser failed to parse MP3 stream\n");
     return NS_ERROR_FAILURE;
   }
 
-  aInfo->mAudio.mRate = mAudioSampleRate;
-  aInfo->mAudio.mChannels = mAudioChannels;
-  aInfo->mAudio.mHasAudio = mStreamReady;
+  if (mStreamReady) {
+    aInfo->mAudio.mRate = mAudioSampleRate;
+    aInfo->mAudio.mChannels = mAudioChannels;
+  }
 
   {
     ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
     mDuration = mMP3FrameParser.GetDuration();
     mDecoder->SetMediaDuration(mDuration);
   }
 
   return NS_OK;
--- a/dom/media/directshow/DirectShowReader.cpp
+++ b/dom/media/directshow/DirectShowReader.cpp
@@ -192,18 +192,18 @@ DirectShowReader::ReadMetadata(MediaInfo
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
 
   WAVEFORMATEX format;
   mAudioSinkFilter->GetSampleSink()->GetAudioFormat(&format);
   NS_ENSURE_TRUE(format.wFormatTag == WAVE_FORMAT_PCM, NS_ERROR_FAILURE);
 
   mInfo.mAudio.mChannels = mNumChannels = format.nChannels;
   mInfo.mAudio.mRate = mAudioRate = format.nSamplesPerSec;
+  mInfo.mAudio.mBitDepth = format.wBitsPerSample;
   mBytesPerSample = format.wBitsPerSample / 8;
-  mInfo.mAudio.mHasAudio = true;
 
   *aInfo = mInfo;
   // Note: The SourceFilter strips ID3v2 tags out of the stream.
   *aTags = nullptr;
 
   // Begin decoding!
   hr = mControl->Run();
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -363,23 +363,22 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo
 {
   if (!mDemuxerInitialized) {
     MonitorAutoLock mon(mDemuxerMonitor);
     bool ok = InvokeAndRetry(this, &MP4Reader::InitDemuxer, mStream, &mDemuxerMonitor);
     NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
     mIndexReady = true;
 
     // To decode, we need valid video and a place to put it.
-    mInfo.mVideo.mHasVideo = mVideo.mActive = mDemuxer->HasValidVideo() &&
-                                              mDecoder->GetImageContainer();
+    mVideo.mActive = mDemuxer->HasValidVideo() && mDecoder->GetImageContainer();
     if (mVideo.mActive) {
       mVideo.mTrackDemuxer = new MP4VideoDemuxer(mDemuxer);
     }
 
-    mInfo.mAudio.mHasAudio = mAudio.mActive = mDemuxer->HasValidAudio();
+    mAudio.mActive = mDemuxer->HasValidAudio();
     if (mAudio.mActive) {
       mAudio.mTrackDemuxer = new MP4AudioDemuxer(mDemuxer);
     }
     mCrypto = mDemuxer->Crypto();
 
     {
       MonitorAutoUnlock unlock(mDemuxerMonitor);
       ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
--- a/dom/media/fmp4/apple/AppleVDADecoder.cpp
+++ b/dom/media/fmp4/apple/AppleVDADecoder.cpp
@@ -260,17 +260,16 @@ AppleVDADecoder::OutputFrame(CVPixelBuff
     aFrameRef->duration,
     aFrameRef->is_sync_point ? " keyframe" : ""
   );
 
   nsRefPtr<MacIOSurface> macSurface = new MacIOSurface(surface);
   // Bounds.
   VideoInfo info;
   info.mDisplay = nsIntSize(mDisplayWidth, mDisplayHeight);
-  info.mHasVideo = true;
   gfx::IntRect visible = gfx::IntRect(0,
                                       0,
                                       mPictureWidth,
                                       mPictureHeight);
 
   nsRefPtr<layers::Image> image =
     mImageContainer->CreateImage(ImageFormat::MAC_IOSURFACE);
   layers::MacIOSurfaceImage* videoImage =
--- a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
+++ b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
@@ -77,18 +77,16 @@ FFmpegH264Decoder<LIBAV_VER>::DoDecodeFr
     mCallback->Error();
     return DecodeResult::DECODE_ERROR;
   }
 
   // If we've decoded a frame then we need to output it
   if (decoded) {
     VideoInfo info;
     info.mDisplay = nsIntSize(mDisplayWidth, mDisplayHeight);
-    info.mStereoMode = StereoMode::MONO;
-    info.mHasVideo = true;
 
     VideoData::YCbCrBuffer b;
     b.mPlanes[0].mData = mFrame->data[0];
     b.mPlanes[0].mStride = mFrame->linesize[0];
     b.mPlanes[0].mHeight = mFrame->height;
     b.mPlanes[0].mWidth = mFrame->width;
     b.mPlanes[0].mOffset = b.mPlanes[0].mSkip = 0;
 
--- a/dom/media/fmp4/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/fmp4/wmf/WMFVideoMFTManager.cpp
@@ -302,17 +302,16 @@ WMFVideoMFTManager::ConfigureVideoFrameG
 
   if (mDXVA2Manager) {
     hr = mDXVA2Manager->ConfigureForSize(width, height);
     NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
   }
 
   // Success! Save state.
   mVideoInfo.mDisplay = displaySize;
-  mVideoInfo.mHasVideo = true;
   GetDefaultStride(mediaType, &mVideoStride);
   mVideoWidth = width;
   mVideoHeight = height;
   mPictureRegion = pictureRegion;
 
   LOG("WMFVideoMFTManager frame geometry frame=(%u,%u) stride=%u picture=(%d, %d, %d, %d) display=(%d,%d) PAR=%d:%d",
       width, height,
       mVideoStride,
--- a/dom/media/gstreamer/GStreamerReader.cpp
+++ b/dom/media/gstreamer/GStreamerReader.cpp
@@ -490,19 +490,23 @@ nsresult GStreamerReader::ReadMetadata(M
       LOG(PR_LOG_DEBUG, "have duration %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));
       duration = GST_TIME_AS_USECONDS (duration);
       mDecoder->SetMediaDuration(duration);
     }
   }
 
   int n_video = 0, n_audio = 0;
   g_object_get(mPlayBin, "n-video", &n_video, "n-audio", &n_audio, nullptr);
-  mInfo.mVideo.mHasVideo = n_video != 0;
-  mInfo.mAudio.mHasAudio = n_audio != 0;
 
+  if (!n_video) {
+    mInfo->mVideo = VideoInfo();
+  }
+  if (!n_audio) {
+    mInfo->mAudio = AudioInfo();
+  }
   *aInfo = mInfo;
 
   *aTags = nullptr;
 
   // Watch the pipeline for fatal errors
 #if GST_VERSION_MAJOR >= 1
   gst_bus_set_sync_handler(mBus, GStreamerReader::ErrorCb, this, nullptr);
 #else
@@ -1048,17 +1052,17 @@ gboolean GStreamerReader::SeekData(GstAp
   } else {
     MOZ_ASSERT(aOffset == static_cast<guint64>(resource->Tell()));
   }
 
   return NS_SUCCEEDED(rv);
 }
 
 GstFlowReturn GStreamerReader::NewPrerollCb(GstAppSink* aSink,
-                                              gpointer aUserData)
+                                            gpointer aUserData)
 {
   GStreamerReader* reader = reinterpret_cast<GStreamerReader*>(aUserData);
 
   if (aSink == reader->mVideoAppSink)
     reader->VideoPreroll();
   else
     reader->AudioPreroll();
   return GST_FLOW_OK;
@@ -1077,17 +1081,16 @@ void GStreamerReader::AudioPreroll()
   GstStructure* s = gst_caps_get_structure(caps, 0);
   mInfo.mAudio.mRate = mInfo.mAudio.mChannels = 0;
   gst_structure_get_int(s, "rate", (gint*) &mInfo.mAudio.mRate);
   gst_structure_get_int(s, "channels", (gint*) &mInfo.mAudio.mChannels);
   NS_ASSERTION(mInfo.mAudio.mRate != 0, ("audio rate is zero"));
   NS_ASSERTION(mInfo.mAudio.mChannels != 0, ("audio channels is zero"));
   NS_ASSERTION(mInfo.mAudio.mChannels > 0 && mInfo.mAudio.mChannels <= MAX_CHANNELS,
       "invalid audio channels number");
-  mInfo.mAudio.mHasAudio = true;
   gst_caps_unref(caps);
   gst_object_unref(sinkpad);
 }
 
 void GStreamerReader::VideoPreroll()
 {
   /* The first video buffer has reached the video sink. Get width and height */
   LOG(PR_LOG_DEBUG, "Video preroll");
@@ -1118,17 +1121,16 @@ void GStreamerReader::VideoPreroll()
   nsIntSize displaySize = nsIntSize(mPicture.width, mPicture.height);
   ScaleDisplayByAspectRatio(displaySize, float(PARNumerator) / float(PARDenominator));
 
   // If video frame size is overflow, stop playing.
   if (IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
     GstStructure* structure = gst_caps_get_structure(caps, 0);
     gst_structure_get_fraction(structure, "framerate", &fpsNum, &fpsDen);
     mInfo.mVideo.mDisplay = displaySize;
-    mInfo.mVideo.mHasVideo = true;
   } else {
     LOG(PR_LOG_DEBUG, "invalid video region");
     Eos();
   }
   gst_caps_unref(caps);
   gst_object_unref(sinkpad);
 }
 
--- a/dom/media/ogg/OggReader.cpp
+++ b/dom/media/ogg/OggReader.cpp
@@ -336,48 +336,47 @@ void OggReader::SetupMediaTracksInfo(con
                                     theoraState->mInfo.pic_y,
                                     theoraState->mInfo.pic_width,
                                     theoraState->mInfo.pic_height);
       nsIntSize displaySize = nsIntSize(theoraState->mInfo.pic_width,
                                         theoraState->mInfo.pic_height);
       nsIntSize frameSize(theoraState->mInfo.frame_width,
                           theoraState->mInfo.frame_height);
       ScaleDisplayByAspectRatio(displaySize, theoraState->mPixelAspectRatio);
-      mInfo.mVideo.mDisplay = displaySize;
-      mInfo.mVideo.mHasVideo = IsValidVideoRegion(frameSize, picture, displaySize)? true:false;
+      if (IsValidVideoRegion(frameSize, picture, displaySize)) {
+        mInfo.mVideo.mDisplay = displaySize;
+      }
     } else if (codecState->GetType() == OggCodecState::TYPE_VORBIS) {
       VorbisState* vorbisState = static_cast<VorbisState*>(codecState);
       if (!(mVorbisState && mVorbisState->mSerial == vorbisState->mSerial)) {
         continue;
       }
 
       if (msgInfo) {
         InitTrack(TrackInfo::kAudioTrack,
                   msgInfo,
                   &mInfo.mAudio,
                   mVorbisState == vorbisState);
       }
 
-      mInfo.mAudio.mHasAudio = true;
       mInfo.mAudio.mRate = vorbisState->mInfo.rate;
       mInfo.mAudio.mChannels = vorbisState->mInfo.channels;
     } else if (codecState->GetType() == OggCodecState::TYPE_OPUS) {
       OpusState* opusState = static_cast<OpusState*>(codecState);
       if (!(mOpusState && mOpusState->mSerial == opusState->mSerial)) {
         continue;
       }
 
       if (msgInfo) {
         InitTrack(TrackInfo::kAudioTrack,
                   msgInfo,
                   &mInfo.mAudio,
                   mOpusState == opusState);
       }
 
-      mInfo.mAudio.mHasAudio = true;
       mInfo.mAudio.mRate = opusState->mRate;
       mInfo.mAudio.mChannels = opusState->mChannels;
     }
   }
 }
 
 nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
                                  MetadataTags** aTags)
@@ -820,18 +819,16 @@ bool OggReader::ReadOggChain()
 
     chained = true;
     tags = newOpusState->GetTags();
   }
 
   if (chained) {
     SetChained(true);
     {
-      mInfo.mAudio.mHasAudio = HasAudio();
-      mInfo.mVideo.mHasVideo = HasVideo();
       nsAutoPtr<MediaInfo> info(new MediaInfo());
       *info = mInfo;
       ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
       mDecoder->QueueMetadata((mDecodedAudioFrames * USECS_PER_S) / mInfo.mAudio.mRate,
                               info, tags);
     }
     return true;
   }
--- a/dom/media/omx/MediaCodecReader.cpp
+++ b/dom/media/omx/MediaCodecReader.cpp
@@ -495,23 +495,23 @@ MediaCodecReader::DecodeVideoFrameTask(i
   } else if (VideoQueue().AtEndOfStream()) {
     mVideoTrack.mVideoPromise.Reject(END_OF_STREAM, __func__);
   }
 }
 
 bool
 MediaCodecReader::HasAudio()
 {
-  return mInfo.mAudio.mHasAudio;
+  return mInfo.HasAudio();
 }
 
 bool
 MediaCodecReader::HasVideo()
 {
-  return mInfo.mVideo.mHasVideo;
+  return mInfo.HasVideo();
 }
 
 void
 MediaCodecReader::NotifyDataArrived(const char* aBuffer,
                                     uint32_t aLength,
                                     int64_t aOffset)
 {
   MonitorAutoLock monLock(mParserMonitor);
@@ -1551,17 +1551,16 @@ MediaCodecReader::UpdateAudioInfo()
   int32_t codec_sample_rate = 0;
   if (!audioCodecFormat->findString("mime", &codec_mime) ||
       !audioCodecFormat->findInt32("channel-count", &codec_channel_count) ||
       !audioCodecFormat->findInt32("sample-rate", &codec_sample_rate)) {
     return false;
   }
 
   // Update AudioInfo
-  mInfo.mAudio.mHasAudio = true;
   mInfo.mAudio.mChannels = codec_channel_count;
   mInfo.mAudio.mRate = codec_sample_rate;
 
   return true;
 }
 
 bool
 MediaCodecReader::UpdateVideoInfo()
@@ -1658,17 +1657,16 @@ MediaCodecReader::UpdateVideoInfo()
                               mVideoTrack.mFrameSize.height;
     relative_picture_rect.width = (picture_rect.width * mVideoTrack.mWidth) /
                                   mVideoTrack.mFrameSize.width;
     relative_picture_rect.height = (picture_rect.height * mVideoTrack.mHeight) /
                                    mVideoTrack.mFrameSize.height;
   }
 
   // Update VideoInfo
-  mInfo.mVideo.mHasVideo = true;
   mVideoTrack.mPictureRect = picture_rect;
   mInfo.mVideo.mDisplay = display_size;
   mVideoTrack.mRelativePictureRect = relative_picture_rect;
 
   return true;
 }
 
 status_t
--- a/dom/media/omx/MediaOmxReader.cpp
+++ b/dom/media/omx/MediaOmxReader.cpp
@@ -319,32 +319,32 @@ nsresult MediaOmxReader::ReadMetadata(Me
     // that our video frame creation code doesn't overflow.
     nsIntSize displaySize(displayWidth, displayHeight);
     nsIntSize frameSize(width, height);
     if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
       return NS_ERROR_FAILURE;
     }
 
     // Video track's frame sizes will not overflow. Activate the video track.
-    mHasVideo = mInfo.mVideo.mHasVideo = true;
+    mHasVideo = true;
     mInfo.mVideo.mDisplay = displaySize;
     mPicture = pictureRect;
     mInitialFrame = frameSize;
     VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
     if (container) {
       container->SetCurrentFrame(gfxIntSize(displaySize.width, displaySize.height),
                                  nullptr,
                                  mozilla::TimeStamp::Now());
     }
   }
 
   if (mOmxDecoder->HasAudio()) {
     int32_t numChannels, sampleRate;
     mOmxDecoder->GetAudioParameters(&numChannels, &sampleRate);
-    mHasAudio = mInfo.mAudio.mHasAudio = true;
+    mHasAudio = true;
     mInfo.mAudio.mChannels = numChannels;
     mInfo.mAudio.mRate = sampleRate;
   }
 
  *aInfo = mInfo;
 
 #ifdef MOZ_AUDIO_OFFLOAD
   CheckAudioOffload();
--- a/dom/media/raw/RawReader.cpp
+++ b/dom/media/raw/RawReader.cpp
@@ -70,17 +70,16 @@ nsresult RawReader::ReadMetadata(MediaIn
   ScaleDisplayByAspectRatio(display, pixelAspectRatio);
   mPicture = nsIntRect(0, 0, mMetadata.frameWidth, mMetadata.frameHeight);
   nsIntSize frameSize(mMetadata.frameWidth, mMetadata.frameHeight);
   if (!IsValidVideoRegion(frameSize, mPicture, display)) {
     // Video track's frame sizes will overflow. Fail.
     return NS_ERROR_FAILURE;
   }
 
-  mInfo.mVideo.mHasVideo = true;
   mInfo.mVideo.mDisplay = display;
 
   mFrameRate = static_cast<float>(mMetadata.framerateNumerator) /
                mMetadata.framerateDenominator;
 
   // Make some sanity checks
   if (mFrameRate > 45 ||
       mFrameRate == 0 ||
--- a/dom/media/wave/WaveReader.cpp
+++ b/dom/media/wave/WaveReader.cpp
@@ -137,17 +137,16 @@ nsresult WaveReader::ReadMetadata(MediaI
 
   nsAutoPtr<dom::HTMLMediaElement::MetadataTags> tags;
 
   bool loadAllChunks = LoadAllChunks(tags);
   if (!loadAllChunks) {
     return NS_ERROR_FAILURE;
   }
 
-  mInfo.mAudio.mHasAudio = true;
   mInfo.mAudio.mRate = mSampleRate;
   mInfo.mAudio.mChannels = mChannels;
 
   *aInfo = mInfo;
 
   *aTags = tags.forget();
 
   ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
--- a/dom/media/webm/WebMReader.cpp
+++ b/dom/media/webm/WebMReader.cpp
@@ -428,17 +428,16 @@ nsresult WebMReader::ReadMetadata(MediaI
       nsIntSize frameSize(params.width, params.height);
       if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
         // Video track's frame sizes will overflow. Ignore the video track.
         continue;
       }
 
       mVideoTrack = track;
       mHasVideo = true;
-      mInfo.mVideo.mHasVideo = true;
 
       mInfo.mVideo.mDisplay = displaySize;
       mPicture = pictureRect;
       mInitialFrame = frameSize;
 
       switch (params.stereo_mode) {
       case NESTEGG_VIDEO_MONO:
         mInfo.mVideo.mStereoMode = StereoMode::MONO;
@@ -461,17 +460,16 @@ nsresult WebMReader::ReadMetadata(MediaI
       r = nestegg_track_audio_params(mContext, track, &params);
       if (r == -1) {
         Cleanup();
         return NS_ERROR_FAILURE;
       }
 
       mAudioTrack = track;
       mHasAudio = true;
-      mInfo.mAudio.mHasAudio = true;
       mAudioCodec = nestegg_track_codec_id(mContext, track);
       mCodecDelay = params.codec_delay / NS_PER_USEC;
 
       if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
         // Get the Vorbis header data
         unsigned int nheaders = 0;
         r = nestegg_track_codec_data_count(mContext, track, &nheaders);
         if (r == -1 || nheaders != 3) {
--- a/dom/media/wmf/WMFReader.cpp
+++ b/dom/media/wmf/WMFReader.cpp
@@ -361,17 +361,17 @@ WMFReader::ConfigureVideoDecoder()
 
   if (FAILED(ConfigureVideoFrameGeometry(mediaType))) {
     NS_WARNING("Failed configured video frame dimensions");
     return hr;
   }
 
   DECODER_LOG("Successfully configured video stream");
 
-  mHasVideo = mInfo.mVideo.mHasVideo = true;
+  mHasVideo = true;
 
   return S_OK;
 }
 
 void
 WMFReader::GetSupportedAudioCodecs(const GUID** aCodecs, uint32_t* aNumCodecs)
 {
   MOZ_ASSERT(aCodecs);
@@ -430,17 +430,17 @@ WMFReader::ConfigureAudioDecoder()
   }
 
   mAudioRate = MFGetAttributeUINT32(mediaType, MF_MT_AUDIO_SAMPLES_PER_SECOND, 0);
   mAudioChannels = MFGetAttributeUINT32(mediaType, MF_MT_AUDIO_NUM_CHANNELS, 0);
   mAudioBytesPerSample = MFGetAttributeUINT32(mediaType, MF_MT_AUDIO_BITS_PER_SAMPLE, 16) / 8;
 
   mInfo.mAudio.mChannels = mAudioChannels;
   mInfo.mAudio.mRate = mAudioRate;
-  mHasAudio = mInfo.mAudio.mHasAudio = true;
+  mHasAudio = true;
 
   DECODER_LOG("Successfully configured audio stream. rate=%u channels=%u bitsPerSample=%u",
               mAudioRate, mAudioChannels, mAudioBytesPerSample);
 
   return S_OK;
 }
 
 HRESULT
@@ -468,17 +468,17 @@ WMFReader::CreateSourceReader()
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = ConfigureVideoDecoder();
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = ConfigureAudioDecoder();
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
-  if (mUseHwAccel && mInfo.mVideo.mHasVideo) {
+  if (mUseHwAccel && mInfo.HasVideo()) {
     RefPtr<IMFTransform> videoDecoder;
     hr = mSourceReader->GetServiceForStream(MF_SOURCE_READER_FIRST_VIDEO_STREAM,
                                             GUID_NULL,
                                             IID_IMFTransform,
                                             (void**)(IMFTransform**)(byRef(videoDecoder)));
 
     if (SUCCEEDED(hr)) {
       ULONG_PTR manager = ULONG_PTR(mDXVA2Manager->GetDXVADeviceManager());
--- a/media/libstagefright/binding/DecoderData.cpp
+++ b/media/libstagefright/binding/DecoderData.cpp
@@ -122,17 +122,16 @@ void
 MP4AudioInfo::Update(const MetaData* aMetaData,
                      const char* aMimeType)
 {
   UpdateTrackInfo(*this, aMetaData, aMimeType);
   mChannels = FindInt32(aMetaData, kKeyChannelCount);
   mBitDepth = FindInt32(aMetaData, kKeySampleSize);
   mRate = FindInt32(aMetaData, kKeySampleRate);
   mProfile = FindInt32(aMetaData, kKeyAACProfile);
-  mHasAudio = true;
 
   if (FindData(aMetaData, kKeyESDS, mExtraData)) {
     ESDS esds(mExtraData->Elements(), mExtraData->Length());
 
     const void* data;
     size_t size;
     if (esds.getCodecSpecificInfo(&data, &size) == OK) {
       const uint8_t* cdata = reinterpret_cast<const uint8_t*>(data);
@@ -160,17 +159,16 @@ MP4AudioInfo::IsValid() const
 void
 MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType)
 {
   UpdateTrackInfo(*this, aMetaData, aMimeType);
   mDisplay.width = FindInt32(aMetaData, kKeyDisplayWidth);
   mDisplay.height = FindInt32(aMetaData, kKeyDisplayHeight);
   mImage.width = FindInt32(aMetaData, kKeyWidth);
   mImage.height = FindInt32(aMetaData, kKeyHeight);
-  mHasVideo = true;
 
   FindData(aMetaData, kKeyAVCC, mExtraData);
 }
 
 bool
 MP4VideoInfo::IsValid() const
 {
   return mDisplay.width > 0 && mDisplay.height > 0;