| 146a1e09 | 06-Oct-2022 |
Hugo Tunius <[email protected]> |
Improve Sample Builder padding handling for static streams (#309)
When sending video streams that are fairly static, such as a screen
share of an inactive screen, libWebRTC will insert padding RTP
Improve Sample Builder padding handling for static streams (#309)
When sending video streams that are fairly static, such as a screen
share of an inactive screen, libWebRTC will insert padding RTP packets.
These were not correctly handled by sample builder, because of this
`SampleBuilder` would throw away packets carrying actual media.
## Example
As an example libWebRTC will send streams like this:
```
p1(t=1, start=true)
p2(t=1)
p3(t=1)
p4(t=1, marker=true)
p5(t=1, padding=true)
p6(t=1, padding=true)
p7(t=1, padding=true)
p8(t=2, start=true, marker=true)
p9(t=2, padding=true)
p10(t=2, padding=true)
p11(t=2, padding=true)
```
Prior to this commit `SampleBuilder` would build a sample out of `p1..=p4`
then drop `p4..=p8`. This would mean the bit of media data in `p8` would
be incorrectly dropped.
The reason for dropping `p4..=p8` is that `p4` is not at a partition head
and `p8` is incorrectly identified as the end of the sample, the real
end is `p7`.
With this commit `SampleBuilder` will build sample out of `p1..=p4`,
identify `p4..=p7` as padding and drop these packets, and build a sample
for `p8`.
There was also a bug where dropping packets because the sample head was
not at a partition start would double count the dropped packets(once in
`build_sample` and once in `purge_buffers`.
show more ...
|