Fixed repushing issues
This commit is contained in:
parent
aa559236ee
commit
8e6af4c591
3 changed files with 26 additions and 5 deletions
|
@ -472,7 +472,7 @@ namespace Mist{
|
||||||
if (!found){
|
if (!found){
|
||||||
jsonForEach((*itb), itc){
|
jsonForEach((*itb), itc){
|
||||||
if (found){break;}
|
if (found){break;}
|
||||||
for (std::map<unsigned int, DTSC::Track>::iterator trit = myMeta.tracks.begin(); trit != myMeta.tracks.end(); trit++){
|
for (std::map<unsigned int, DTSC::Track>::reverse_iterator trit = myMeta.tracks.rbegin(); trit != myMeta.tracks.rend(); trit++){
|
||||||
if (trit->second.codec == (*itc).asStringRef() || (*itc).asStringRef() == "*"){
|
if (trit->second.codec == (*itc).asStringRef() || (*itc).asStringRef() == "*"){
|
||||||
selectedTracks.insert(trit->first);
|
selectedTracks.insert(trit->first);
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -1178,6 +1178,11 @@ namespace Mist{
|
||||||
static int nonVideoCount = 0;
|
static int nonVideoCount = 0;
|
||||||
static unsigned int emptyCount = 0;
|
static unsigned int emptyCount = 0;
|
||||||
if (!buffer.size()){
|
if (!buffer.size()){
|
||||||
|
if (isRecording() && myMeta.live){
|
||||||
|
selectDefaultTracks();
|
||||||
|
initialSeek();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
thisPacket.null();
|
thisPacket.null();
|
||||||
INFO_MSG("Buffer completely played out");
|
INFO_MSG("Buffer completely played out");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1604,9 +1609,13 @@ namespace Mist{
|
||||||
nProxy.userClient.finish();
|
nProxy.userClient.finish();
|
||||||
nProxy.userClient = IPC::sharedClient();
|
nProxy.userClient = IPC::sharedClient();
|
||||||
}
|
}
|
||||||
|
if (statsPage.getData()){
|
||||||
|
statsPage.keepAlive();
|
||||||
|
}
|
||||||
Util::wait(1000);
|
Util::wait(1000);
|
||||||
streamStatus = Util::getStreamStatus(streamName);
|
streamStatus = Util::getStreamStatus(streamName);
|
||||||
if (streamStatus == STRMSTAT_OFF || streamStatus == STRMSTAT_WAIT || streamStatus == STRMSTAT_READY){
|
if (streamStatus == STRMSTAT_OFF || streamStatus == STRMSTAT_WAIT || streamStatus == STRMSTAT_READY){
|
||||||
|
INFO_MSG("Reconnecting to %s buffer... (%u)", streamName.c_str(), streamStatus);
|
||||||
reconnect();
|
reconnect();
|
||||||
streamStatus = Util::getStreamStatus(streamName);
|
streamStatus = Util::getStreamStatus(streamName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
namespace Mist{
|
namespace Mist{
|
||||||
OutRTMP::OutRTMP(Socket::Connection & conn) : Output(conn){
|
OutRTMP::OutRTMP(Socket::Connection & conn) : Output(conn){
|
||||||
|
lastOutTime = 0;
|
||||||
|
rtmpOffset = 0;
|
||||||
maxbps = config->getInteger("maxkbps")*128;
|
maxbps = config->getInteger("maxkbps")*128;
|
||||||
if (config->getString("target").size() && config->getString("target").substr(0, 7) == "rtmp://"){
|
if (config->getString("target").size() && config->getString("target").substr(0, 7) == "rtmp://"){
|
||||||
streamName = config->getString("streamname");
|
streamName = config->getString("streamname");
|
||||||
|
@ -263,7 +265,6 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutRTMP::sendNext(){
|
void OutRTMP::sendNext(){
|
||||||
|
|
||||||
//If there are now more selectable tracks, select the new track and do a seek to the current timestamp
|
//If there are now more selectable tracks, select the new track and do a seek to the current timestamp
|
||||||
//Set sentHeader to false to force it to send init data
|
//Set sentHeader to false to force it to send init data
|
||||||
if (myMeta.live && selectedTracks.size() < 2){
|
if (myMeta.live && selectedTracks.size() < 2){
|
||||||
|
@ -284,6 +285,16 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (streamOut.size()){
|
||||||
|
if (thisPacket.getTime() - rtmpOffset < lastOutTime){
|
||||||
|
int64_t OLD = rtmpOffset;
|
||||||
|
rtmpOffset -= (1 + lastOutTime - (thisPacket.getTime() - rtmpOffset));
|
||||||
|
INFO_MSG("Changing rtmpOffset from %lld to %lld", OLD, rtmpOffset);
|
||||||
|
realTime = 800;
|
||||||
|
}
|
||||||
|
lastOutTime = thisPacket.getTime() - rtmpOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char rtmpheader[] ={0, //byte 0 = cs_id | ch_type
|
char rtmpheader[] ={0, //byte 0 = cs_id | ch_type
|
||||||
0, 0, 0, //bytes 1-3 = timestamp
|
0, 0, 0, //bytes 1-3 = timestamp
|
||||||
|
@ -390,9 +401,9 @@ namespace Mist{
|
||||||
|
|
||||||
unsigned int timestamp = thisPacket.getTime() - rtmpOffset;
|
unsigned int timestamp = thisPacket.getTime() - rtmpOffset;
|
||||||
//make sure we don't go negative
|
//make sure we don't go negative
|
||||||
if (rtmpOffset > thisPacket.getTime()){
|
if (rtmpOffset > (int64_t)thisPacket.getTime()){
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
rtmpOffset = thisPacket.getTime();
|
rtmpOffset = (int64_t)thisPacket.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allow_short = RTMPStream::lastsend.count(4);
|
bool allow_short = RTMPStream::lastsend.count(4);
|
||||||
|
|
|
@ -18,7 +18,8 @@ namespace Mist {
|
||||||
bool onFinish();
|
bool onFinish();
|
||||||
protected:
|
protected:
|
||||||
std::string streamOut;///<When pushing out, the output stream name
|
std::string streamOut;///<When pushing out, the output stream name
|
||||||
uint64_t rtmpOffset;
|
int64_t rtmpOffset;
|
||||||
|
uint64_t lastOutTime;
|
||||||
unsigned int maxbps;
|
unsigned int maxbps;
|
||||||
void parseVars(std::string data);
|
void parseVars(std::string data);
|
||||||
std::string app_name;
|
std::string app_name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue