This should fix all DTSC reading speed-related issues.
This commit is contained in:
parent
331fac9146
commit
9fb606aa4f
2 changed files with 14 additions and 8 deletions
|
@ -117,9 +117,6 @@ namespace Buffer{
|
|||
//slow down packet receiving to real-time
|
||||
now = getNowMS();
|
||||
if ((now - lastPacketTime >= currPacketTime - prevPacketTime) || (currPacketTime <= prevPacketTime)){
|
||||
std::cin.read(charBuffer, 1024*10);
|
||||
charCount = std::cin.gcount();
|
||||
inBuffer.append(charBuffer, charCount);
|
||||
thisStream->getWriteLock();
|
||||
if (thisStream->getStream()->parsePacket(inBuffer)){
|
||||
thisStream->getStream()->outPacket(0);
|
||||
|
@ -129,6 +126,9 @@ namespace Buffer{
|
|||
thisStream->dropWriteLock(true);
|
||||
}else{
|
||||
thisStream->dropWriteLock(false);
|
||||
std::cin.read(charBuffer, 1024*10);
|
||||
charCount = std::cin.gcount();
|
||||
inBuffer.append(charBuffer, charCount);
|
||||
}
|
||||
}else{
|
||||
if (((currPacketTime - prevPacketTime) - (now - lastPacketTime)) > 999){
|
||||
|
@ -149,17 +149,22 @@ namespace Buffer{
|
|||
std::string inBuffer;
|
||||
while (buffer_running){
|
||||
if (thisStream->getIPInput().connected()){
|
||||
if (thisStream->getIPInput().iread(inBuffer)){
|
||||
if (inBuffer.size() > 0){
|
||||
thisStream->getWriteLock();
|
||||
if (thisStream->getStream()->parsePacket(inBuffer)){
|
||||
thisStream->getStream()->outPacket(0);
|
||||
thisStream->dropWriteLock(true);
|
||||
}else{
|
||||
thisStream->dropWriteLock(false);
|
||||
thisStream->getIPInput().iread(inBuffer);
|
||||
usleep(1000);//1ms wait
|
||||
}
|
||||
}else{
|
||||
thisStream->getIPInput().iread(inBuffer);
|
||||
usleep(1000);//1ms wait
|
||||
}
|
||||
}else{
|
||||
usleep(1000000);
|
||||
usleep(1000000);//1s wait
|
||||
}
|
||||
}
|
||||
SS.close();
|
||||
|
|
|
@ -27,9 +27,6 @@ namespace Converters{
|
|||
bool doneheader = false;
|
||||
|
||||
while (std::cin.good()){
|
||||
std::cin.read(charBuffer, 1024*10);
|
||||
charCount = std::cin.gcount();
|
||||
inBuffer.append(charBuffer, charCount);
|
||||
if (Strm.parsePacket(inBuffer)){
|
||||
if (!doneheader){
|
||||
doneheader = true;
|
||||
|
@ -48,6 +45,10 @@ namespace Converters{
|
|||
if (FLV_out.DTSCLoader(Strm)){
|
||||
std::cout.write(FLV_out.data, FLV_out.len);
|
||||
}
|
||||
}else{
|
||||
std::cin.read(charBuffer, 1024*10);
|
||||
charCount = std::cin.gcount();
|
||||
inBuffer.append(charBuffer, charCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue