From 7124f6070b2bdda7f539bccedfee66966a2ddca1 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 13 Jan 2021 21:06:21 +0100 Subject: [PATCH] RTMP header sends now use the current media timestamp instead of a hardcoded 0. --- src/output/output_rtmp.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/output/output_rtmp.cpp b/src/output/output_rtmp.cpp index 1d72e93c..3bd590f9 100644 --- a/src/output/output_rtmp.cpp +++ b/src/output/output_rtmp.cpp @@ -573,21 +573,31 @@ namespace Mist{ selectedTracks.insert(it->first); } tag.DTSCMetaInit(meta, selectedTracks); - if (tag.len){myConn.SendNow(RTMPStream::SendMedia(tag));} + if (tag.len){ + tag.tagTime(currentTime()); + myConn.SendNow(RTMPStream::SendMedia(tag)); + } for (std::set::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){ std::string type = M.getType(*it); if (type == "video"){ - if (tag.DTSCVideoInit(meta, *it)){myConn.SendNow(RTMPStream::SendMedia(tag));} + if (tag.DTSCVideoInit(meta, *it)){ + tag.tagTime(currentTime()); + myConn.SendNow(RTMPStream::SendMedia(tag)); + } } if (type == "audio"){ - if (tag.DTSCAudioInit(meta.getCodec(*it), meta.getRate(*it), meta.getSize(*it), meta.getChannels(*it), meta.getInit(*it))){myConn.SendNow(RTMPStream::SendMedia(tag));} + if (tag.DTSCAudioInit(meta.getCodec(*it), meta.getRate(*it), meta.getSize(*it), meta.getChannels(*it), meta.getInit(*it))){ + tag.tagTime(currentTime()); + myConn.SendNow(RTMPStream::SendMedia(tag)); + } } } //Insert silent init data if audio set to silent hasSilence = (targetParams.count("audio") && targetParams["audio"] == "silent"); if (hasSilence && tag.DTSCAudioInit("AAC", 44100, 32, 2, std::string("\022\020V\345\000", 5))){ INFO_MSG("Inserting silence track init data"); + tag.tagTime(currentTime()); myConn.SendNow(RTMPStream::SendMedia(tag)); } sentHeader = true;