mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
prevent cycle for time lantency and available size
This commit is contained in:
parent
adaffcc245
commit
6f05cf803d
@ -111,6 +111,7 @@ uint32_t PacketQueue::timeLantency() {
|
||||
}
|
||||
|
||||
if(dur > 0x80000000){
|
||||
//WarnL<<"cycle dur "<<dur;
|
||||
dur = 0xffffffff - dur;
|
||||
}
|
||||
|
||||
@ -163,11 +164,17 @@ size_t PacketQueue::getExpectedSize() {
|
||||
if(_pkt_map.empty()){
|
||||
return 0;
|
||||
}
|
||||
return _pkt_map.rbegin()->first - _pkt_expected_seq+1;
|
||||
auto size = _pkt_map.rbegin()->first - _pkt_expected_seq+1;
|
||||
if(size >= _pkt_cap){
|
||||
// 回环
|
||||
//WarnL<<"cycle size "<<size;
|
||||
size = 0xffffffff - size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t PacketQueue::getAvailableBufferSize(){
|
||||
return _pkt_cap - getExpectedSize();
|
||||
return _pkt_cap - getSize();
|
||||
}
|
||||
|
||||
uint32_t PacketQueue::getExpectedSeq(){
|
||||
|
Loading…
Reference in New Issue
Block a user