From 4b0ea967d859b4061f2790c8ccec5f66ba367126 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 31 Jan 2017 11:39:06 +0100 Subject: [PATCH] Fixed no-audio streams in MP4 live in Chrome --- src/output/output_progressive_mp4.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/output/output_progressive_mp4.cpp b/src/output/output_progressive_mp4.cpp index 8d01e4f3..af93aecf 100644 --- a/src/output/output_progressive_mp4.cpp +++ b/src/output/output_progressive_mp4.cpp @@ -554,6 +554,7 @@ namespace Mist { bool firstSample = true; + bool hasAudio = false; //Fun fact! Firefox cares about the ordering here. //It doesn't care about the order or track IDs in the header. //But - the first TRAF must be a video TRAF, if video is present. @@ -562,6 +563,9 @@ namespace Mist { if (myMeta.tracks[it->first].type == "video"){ sortedTracks.push_front(it); }else{ + if (myMeta.tracks[it->first].type == "audio"){ + hasAudio = true; + } sortedTracks.push_back(it); } } @@ -611,7 +615,7 @@ namespace Mist { } //Oh god why do we do this. - if (chromeWorkaround && fragSeqNum == 1){ + if (chromeWorkaround && hasAudio && fragSeqNum == 1){ MP4::TRAF trafBox; MP4::TRUN trunBox; trunBox.setFlags(MP4::trundataOffset | MP4::trunfirstSampleFlags | MP4::trunsampleSize | MP4::trunsampleDuration);