Handle time stamp increment across mute. (#1705)
* Handle time stamp increment across mute. Two cases handled 1. Starting on mute could inject blank frame/padding packets. These time stamps are randomly generated. So, when the publisher unmutes, the time stamp was jumping ahead by only 1. Make it so that they jump ahead by elapsed time since starting the blank frames/ padding packets. 2. When generating blank frames at the end of a down track, if the track was muted at that time, the blank frame time stamps could have been off (i. e. would have been pointing to time after the last forwarded frame). Here also use current time to adjust time stamp. Maybe, this could help in some cases where we are seeing unflushed video buffer? * remove unnecessary check * address feedback and also maintain first synthesized time stamp
This commit is contained in:
@@ -1844,9 +1844,15 @@ func TestForwardGetSnTsForBlankFrames(t *testing.T) {
|
||||
frameRate := uint32(30)
|
||||
var sntsExpected = make([]SnTs, numPadding)
|
||||
for i := 0; i < numPadding; i++ {
|
||||
// first blank frame should have same timestamp as last frame as end frame is synthesized
|
||||
ts := params.Timestamp
|
||||
if i != 0 {
|
||||
// +1 here due to expected time stamp bumpint by at least one so that time stamp is always moving ahead
|
||||
ts = params.Timestamp + 1 + ((uint32(i)*clockRate)+frameRate-1)/frameRate
|
||||
}
|
||||
sntsExpected[i] = SnTs{
|
||||
sequenceNumber: params.SequenceNumber + uint16(i) + 1,
|
||||
timestamp: params.Timestamp + (uint32(i)*clockRate)/frameRate,
|
||||
timestamp: ts,
|
||||
}
|
||||
}
|
||||
require.Equal(t, sntsExpected, snts)
|
||||
@@ -1858,7 +1864,8 @@ func TestForwardGetSnTsForBlankFrames(t *testing.T) {
|
||||
for i := 0; i < numPadding; i++ {
|
||||
sntsExpected[i] = SnTs{
|
||||
sequenceNumber: params.SequenceNumber + uint16(len(snts)) + uint16(i) + 1,
|
||||
timestamp: snts[len(snts)-1].timestamp + (uint32(i+1)*clockRate)/frameRate,
|
||||
// +1 here due to expected time stamp bumpint by at least one so that time stamp is always moving ahead
|
||||
timestamp: snts[len(snts)-1].timestamp + 1 + ((uint32(i+1)*clockRate)+frameRate-1)/frameRate,
|
||||
}
|
||||
}
|
||||
snts, frameEndNeeded, err = f.GetSnTsForBlankFrames(30, numBlankFrames)
|
||||
|
||||
Reference in New Issue
Block a user