Bug 1208799 - [webm] Use first track found. r=kinetik. r=sylvestre
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 27 Sep 2015 15:52:28 +1000
changeset 296166 c0526447cff40675719d5ac0eb1ce04d175d94af
parent 296165 f8c3934ab6145a130593965a7c4e80fb87f7d358
child 296167 1167c42d21e42678418e3f303c5b31f4b6e8e098
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, sylvestre
bugs1208799
milestone43.0a2
Bug 1208799 - [webm] Use first track found. r=kinetik. r=sylvestre
dom/media/webm/WebMDemuxer.cpp
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -284,17 +284,17 @@ WebMDemuxer::ReadMetadata()
   }
 
   for (unsigned int track = 0; track < ntracks; ++track) {
     int id = nestegg_track_codec_id(mContext, track);
     if (id == -1) {
       return NS_ERROR_FAILURE;
     }
     int type = nestegg_track_type(mContext, track);
-    if (type == NESTEGG_TRACK_VIDEO) {
+    if (type == NESTEGG_TRACK_VIDEO && !mHasVideo) {
       nestegg_video_params params;
       r = nestegg_track_video_params(mContext, track, &params);
       if (r == -1) {
         return NS_ERROR_FAILURE;
       }
       mVideoCodec = nestegg_track_codec_id(mContext, track);
       switch(mVideoCodec) {
         case NESTEGG_CODEC_VP8:
@@ -359,17 +359,17 @@ WebMDemuxer::ReadMetadata()
           mInfo.mVideo.mStereoMode = StereoMode::RIGHT_LEFT;
           break;
       }
       uint64_t duration = 0;
       r = nestegg_duration(mContext, &duration);
       if (!r) {
         mInfo.mVideo.mDuration = media::TimeUnit::FromNanoseconds(duration).ToMicroseconds();
       }
-    } else if (type == NESTEGG_TRACK_AUDIO) {
+    } else if (type == NESTEGG_TRACK_AUDIO && !mHasAudio) {
       nestegg_audio_params params;
       r = nestegg_track_audio_params(mContext, track, &params);
       if (r == -1) {
         return NS_ERROR_FAILURE;
       }
 
       mAudioTrack = track;
       mHasAudio = true;