Fixed handling of stuffing bytes in TS packets.
This commit is contained in:
parent
4f4c1784b8
commit
af4caded70
1 changed files with 14 additions and 10 deletions
|
@ -323,19 +323,23 @@ void TS::Packet::AddStuffing(int NumBytes){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (AdaptationField() == 3){
|
if (AdaptationField() == 3){
|
||||||
int Offset = strBuf[4];
|
strBuf.resize(5 + strBuf[4]);
|
||||||
strBuf[4] = Offset + NumBytes - 1;
|
strBuf[4] += NumBytes;
|
||||||
strBuf.resize(5 + Offset + NumBytes - 2);
|
for (int i = 0; i < NumBytes; i++){
|
||||||
for (int i = 0; i < (NumBytes - 2); i++){
|
strBuf.append(FILLER_DATA + (i % sizeof(FILLER_DATA)), 1);
|
||||||
strBuf[5 + Offset + i] = FILLER_DATA[i % sizeof(FILLER_DATA)];
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
AdaptationField(3);
|
AdaptationField(3);
|
||||||
|
if (NumBytes > 1){
|
||||||
strBuf.resize(6);
|
strBuf.resize(6);
|
||||||
strBuf[4] = (char)(NumBytes - 1);
|
strBuf[4] = (char)(NumBytes - 1);
|
||||||
strBuf[5] = (char)0x00;
|
strBuf[5] = (char)0x00;
|
||||||
for (int i = 0; i < (NumBytes - 2); i++){
|
for (int i = 0; i < (NumBytes - 2); i++){
|
||||||
strBuf += FILLER_DATA[i % sizeof(FILLER_DATA)];
|
strBuf += FILLER_DATA[i % sizeof(FILLER_DATA)];
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
strBuf.resize(5);
|
||||||
|
strBuf[4] = (char)(NumBytes - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue