Bug 1208799: [webm] Use first track found. r=kinetik
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 27 Sep 2015 15:52:28 +1000
changeset 264890 14c82d6b268ce73855bcaf4a5f2b9845b8bf52ca
parent 264889 7d130726b9759291f4e4bba13c44527d4ac33402
child 264891 33cdf7fca53137d641c7933506f08116494e04d8
push id29450
push usercbook@mozilla.com
push dateTue, 29 Sep 2015 10:00:39 +0000
treeherdermozilla-central@acdb22976ff8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1208799
milestone44.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 1208799: [webm] Use first track found. r=kinetik
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;