RTMP fixes for streams > 5h in duration.

This commit is contained in:
Thulinma 2016-07-22 11:25:38 +02:00
parent 7d4fd24866
commit dd612a2643
3 changed files with 22 additions and 4 deletions

View file

@ -465,6 +465,7 @@ bool RTMPStream::Chunk::Parse(Socket::Buffer & buffer) {
timestamp += indata[i++ ] * 256 * 256;
timestamp += indata[i++ ] * 256 * 256 * 256;
ts_delta = timestamp;
DEBUG_MSG(DLVL_DONTEVEN, "Extended timestamp: %u", timestamp);
}
//read data if length > 0, and allocate it

View file

@ -277,7 +277,7 @@ namespace Mist {
}
data_len += dheader_len;
unsigned int timestamp = thisPacket.getTime();
unsigned int timestamp = thisPacket.getTime() - rtmpOffset;
bool allow_short = RTMPStream::lastsend.count(4);
RTMPStream::Chunk & prev = RTMPStream::lastsend[4];
@ -424,7 +424,7 @@ namespace Mist {
}
app_name = amfData.getContentP(2)->getContentP("tcUrl")->StrValue();
app_name = app_name.substr(app_name.find('/', 7) + 1);
RTMPStream::chunk_snd_max = 4096;
RTMPStream::chunk_snd_max = 10240000;
myConn.SendNow(RTMPStream::SendCTL(1, RTMPStream::chunk_snd_max)); //send chunk size max (msg 1)
myConn.SendNow(RTMPStream::SendCTL(5, RTMPStream::snd_window_size)); //send window acknowledgement size (msg 5)
myConn.SendNow(RTMPStream::SendCTL(6, RTMPStream::rec_window_size)); //send rec window acknowledgement size (msg 6)
@ -679,8 +679,16 @@ namespace Mist {
amfreply.getContentP(3)->addContent(AMF::Object("description", "Playing!"));
amfreply.getContentP(3)->addContent(AMF::Object("details", "DDV"));
amfreply.getContentP(3)->addContent(AMF::Object("clientid", (double)1337));
uint64_t earliestTime = 0xffffffffffffffff;
for (std::set<unsigned long>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks.count(*it) && myMeta.tracks[*it].firstms < earliestTime){
earliestTime = myMeta.tracks[*it].firstms;
}
}
rtmpOffset = earliestTime;
amfreply.getContentP(3)->addContent(AMF::Object("timecodeOffset", (double)rtmpOffset));
sendCommand(amfreply, playMessageType, playStreamId);
RTMPStream::chunk_snd_max = 102400; //100KiB
RTMPStream::chunk_snd_max = 10240000; //10000KiB
myConn.SendNow(RTMPStream::SendCTL(1, RTMPStream::chunk_snd_max)); //send chunk size max (msg 1)
//send dunno?
myConn.SendNow(RTMPStream::SendUSR(32, 1)); //send UCM no clue?, stream 1
@ -736,8 +744,16 @@ namespace Mist {
amfreply.getContentP(3)->addContent(AMF::Object("description", "Playing!"));
amfreply.getContentP(3)->addContent(AMF::Object("details", "DDV"));
amfreply.getContentP(3)->addContent(AMF::Object("clientid", (double)1337));
uint64_t earliestTime = 0xffffffffffffffff;
for (std::set<unsigned long>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks.count(*it) && myMeta.tracks[*it].firstms < earliestTime){
earliestTime = myMeta.tracks[*it].firstms;
}
}
rtmpOffset = earliestTime;
amfreply.getContentP(3)->addContent(AMF::Object("timecodeOffset", (double)rtmpOffset));
sendCommand(amfreply, playMessageType, playStreamId);
RTMPStream::chunk_snd_max = 102400; //100KiB
RTMPStream::chunk_snd_max = 10240000; //10000KiB
myConn.SendNow(RTMPStream::SendCTL(1, RTMPStream::chunk_snd_max)); //send chunk size max (msg 1)
//send dunno?
myConn.SendNow(RTMPStream::SendUSR(32, 1)); //send UCM no clue?, stream 1

View file

@ -16,6 +16,7 @@ namespace Mist {
bool isReadyForPlay();
bool onFinish();
protected:
uint64_t rtmpOffset;
bool isPushing;
void parseVars(std::string data);
std::string app_name;