Gadver
This commit is contained in:
parent
0a04e77458
commit
a72dc83304
2 changed files with 17 additions and 21 deletions
|
@ -66,9 +66,7 @@ int main(int argc, char ** argv){
|
||||||
unsigned int fts = 0;
|
unsigned int fts = 0;
|
||||||
unsigned int ftst;
|
unsigned int ftst;
|
||||||
int ss;
|
int ss;
|
||||||
FLV_Pack * tag[2];
|
FLV_Pack * tag = 0;
|
||||||
tag[0] = 0;
|
|
||||||
tag[1] = 0;
|
|
||||||
|
|
||||||
//first timestamp set
|
//first timestamp set
|
||||||
firsttime = getNowMS();
|
firsttime = getNowMS();
|
||||||
|
@ -133,30 +131,27 @@ int main(int argc, char ** argv){
|
||||||
|
|
||||||
retval = epoll_wait(poller, events, 1, 50);
|
retval = epoll_wait(poller, events, 1, 50);
|
||||||
if (DDV_ready(ss)){
|
if (DDV_ready(ss)){
|
||||||
if (FLV_GetPacket(tag[0], ss)){//able to read a full packet?
|
if (FLV_GetPacket(tag, ss)){//able to read a full packet?
|
||||||
FLV_Pack * tmptag = tag[0];
|
ts = tag->data[7] * 256*256*256;
|
||||||
tag[0] = tag[1];
|
ts += tag->data[4] * 256*256;
|
||||||
tag[1] = tmptag;
|
ts += tag->data[5] * 256;
|
||||||
ts = tag[1]->data[7] * 256*256*256;
|
ts += tag->data[6];
|
||||||
ts += tag[1]->data[4] * 256*256;
|
|
||||||
ts += tag[1]->data[5] * 256;
|
|
||||||
ts += tag[1]->data[6];
|
|
||||||
if (ts != 0){
|
if (ts != 0){
|
||||||
if (fts == 0){fts = ts;ftst = getNowMS();}
|
if (fts == 0){fts = ts;ftst = getNowMS();}
|
||||||
ts -= fts;
|
ts -= fts;
|
||||||
tag[1]->data[7] = ts / (256*256*256);
|
tag->data[7] = ts / (256*256*256);
|
||||||
tag[1]->data[4] = ts / (256*256);
|
tag->data[4] = ts / (256*256);
|
||||||
tag[1]->data[5] = ts / 256;
|
tag->data[5] = ts / 256;
|
||||||
tag[1]->data[6] = ts % 256;
|
tag->data[6] = ts % 256;
|
||||||
ts += ftst;
|
ts += ftst;
|
||||||
}else{
|
}else{
|
||||||
ftst = getNowMS();
|
ftst = getNowMS();
|
||||||
tag[1]->data[7] = ftst / (256*256*256);
|
tag->data[7] = ftst / (256*256*256);
|
||||||
tag[1]->data[4] = ftst / (256*256);
|
tag->data[4] = ftst / (256*256);
|
||||||
tag[1]->data[5] = ftst / 256;
|
tag->data[5] = ftst / 256;
|
||||||
tag[1]->data[6] = ftst % 256;
|
tag->data[6] = ftst % 256;
|
||||||
}
|
}
|
||||||
SendMedia((unsigned char)tag[1]->data[0], (unsigned char *)tag[1]->data+11, tag[1]->len-15, ts);
|
SendMedia((unsigned char)tag->data[0], (unsigned char *)tag->data+11, tag->len-15, ts);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Sent a tag to %i\n", CONN_fd);
|
fprintf(stderr, "Sent a tag to %i\n", CONN_fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,7 @@ bool ReadUntil(char * buffer, unsigned int count, unsigned int & sofar, int sock
|
||||||
if (sofar >= count){return true;}
|
if (sofar >= count){return true;}
|
||||||
int r = 0;
|
int r = 0;
|
||||||
r = DDV_iread(buffer + sofar,count-sofar,sock);
|
r = DDV_iread(buffer + sofar,count-sofar,sock);
|
||||||
|
fprintf(stderr, "Reading %i/%i, read %i, at %i\n", count, sofar, r, buffer+sofar);
|
||||||
if (r < 0){
|
if (r < 0){
|
||||||
if (errno != EWOULDBLOCK){
|
if (errno != EWOULDBLOCK){
|
||||||
All_Hell_Broke_Loose = true;
|
All_Hell_Broke_Loose = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue