Further fixes and optimizes to RTMP and generic output.

This commit is contained in:
Thulinma 2014-05-15 16:15:26 +02:00
parent 6f5f3b37c2
commit 407d2e344d
2 changed files with 10 additions and 3 deletions

View file

@ -487,6 +487,14 @@ namespace Mist {
statsPage.keepAlive(); statsPage.keepAlive();
} }
int tNum = 0; int tNum = 0;
if (!playerConn.getData()){
playerConn = IPC::sharedClient(streamName + "_users", 30, true);
if (!playerConn.getData()){
DEBUG_MSG(DLVL_WARN, "Player connection failure - aborting output");
myConn.close();
return;
}
}
for (std::set<unsigned long>::iterator it = selectedTracks.begin(); it != selectedTracks.end() && tNum < 5; it++){ for (std::set<unsigned long>::iterator it = selectedTracks.begin(); it != selectedTracks.end() && tNum < 5; it++){
char thisData[6]; char thisData[6];
thisData[0] = ((*it >> 24) & 0xFF); thisData[0] = ((*it >> 24) & 0xFF);

View file

@ -7,10 +7,9 @@
namespace Mist { namespace Mist {
OutRTMP::OutRTMP(Socket::Connection & conn) : Output(conn) { OutRTMP::OutRTMP(Socket::Connection & conn) : Output(conn) {
setBlocking(false); setBlocking(true);
while (!conn.Received().available(1537) && conn.connected()) { while (!conn.Received().available(1537) && conn.connected()) {
conn.spool(); conn.spool();
Util::sleep(5);
} }
if (!conn){ if (!conn){
return; return;
@ -22,7 +21,6 @@ namespace Mist {
conn.SendNow(RTMPStream::handshake_out); conn.SendNow(RTMPStream::handshake_out);
while (!conn.Received().available(1536) && conn.connected()) { while (!conn.Received().available(1536) && conn.connected()) {
conn.spool(); conn.spool();
Util::sleep(5);
} }
conn.Received().remove(1536); conn.Received().remove(1536);
RTMPStream::rec_cnt += 1536; RTMPStream::rec_cnt += 1536;
@ -30,6 +28,7 @@ namespace Mist {
} else { } else {
DEBUG_MSG(DLVL_DEVEL, "Handshake fail!"); DEBUG_MSG(DLVL_DEVEL, "Handshake fail!");
} }
setBlocking(false);
counter = 0; counter = 0;
sending = false; sending = false;
streamReset = false; streamReset = false;