diff --git a/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd b/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd index 785c185548..06363446d4 100644 --- a/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd +++ b/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd @@ -12,15 +12,15 @@ - - bear-640x360-video-trick_play_factor_2.mp4 - + + bear-640x360-video-trick_play_factor_1.mp4 + - - bear-640x360-video-trick_play_factor_1.mp4 - + + bear-640x360-video-trick_play_factor_2.mp4 + diff --git a/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd b/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd index f2cb141877..29c07d0482 100644 --- a/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd +++ b/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd @@ -20,15 +20,15 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video-trick_play_factor_2.mp4 - + + bear-640x360-video-trick_play_factor_1.mp4 + - - bear-640x360-video-trick_play_factor_1.mp4 - + + bear-640x360-video-trick_play_factor_2.mp4 + diff --git a/packager/packager.cc b/packager/packager.cc index 82ba9a2ab5..b3a2aafd25 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -317,15 +317,16 @@ Status ValidateParams(const PackagingParams& packaging_params, bool StreamDescriptorCompareFn(const StreamDescriptor& a, const StreamDescriptor& b) { + // This function is used by std::sort() to sort the stream descriptors. + // Note that std::sort() need a comparator that return true iff the first + // argument is strictly lower than the second one. That is: must return false + // when they are equal. The requirement is enforced in gcc/g++ but not in + // clang. if (a.input == b.input) { if (a.stream_selector == b.stream_selector) { // The MPD notifier requires that the main track comes first, so make // sure that happens. - if (a.trick_play_factor == 0 || b.trick_play_factor == 0) { - return a.trick_play_factor == 0; - } else { - return a.trick_play_factor > b.trick_play_factor; - } + return a.trick_play_factor < b.trick_play_factor; } else { return a.stream_selector < b.stream_selector; }