Fixed reading FLV files taking 100% CPU.
This commit is contained in:
parent
de46eee3b9
commit
e1f7d2acea
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "amf.h"
|
#include "amf.h"
|
||||||
#include "rtmpchunks.h"
|
#include "rtmpchunks.h"
|
||||||
#include "flv_tag.h"
|
#include "flv_tag.h"
|
||||||
|
#include "timing.h"
|
||||||
#include <stdio.h> //for Tag::FileLoader
|
#include <stdio.h> //for Tag::FileLoader
|
||||||
#include <unistd.h> //for Tag::FileLoader
|
#include <unistd.h> //for Tag::FileLoader
|
||||||
#include <fcntl.h> //for Tag::FileLoader
|
#include <fcntl.h> //for Tag::FileLoader
|
||||||
|
@ -913,6 +914,8 @@ bool FLV::Tag::FileLoader(FILE * f){
|
||||||
Error_Str = "Invalid header received.";
|
Error_Str = "Invalid header received.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
Util::sleep(100);//sleep 100ms
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//if a tag header, calculate length and read tag body
|
//if a tag header, calculate length and read tag body
|
||||||
|
@ -933,6 +936,8 @@ bool FLV::Tag::FileLoader(FILE * f){
|
||||||
}
|
}
|
||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
Util::sleep(100);//sleep 100ms
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//read tag body
|
//read tag body
|
||||||
|
@ -947,6 +952,8 @@ bool FLV::Tag::FileLoader(FILE * f){
|
||||||
sofar = 0;
|
sofar = 0;
|
||||||
fcntl(fileno(f), F_SETFL, preflags);
|
fcntl(fileno(f), F_SETFL, preflags);
|
||||||
return true;
|
return true;
|
||||||
|
}else{
|
||||||
|
Util::sleep(100);//sleep 100ms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fcntl(fileno(f), F_SETFL, preflags);
|
fcntl(fileno(f), F_SETFL, preflags);
|
||||||
|
|
Loading…
Add table
Reference in a new issue