Do not restart receiver on codec change mid-session. (#4225)

* Do not restart receiver on codec change mid-session.

This is not supported and was an erroneous change during the
receiver_base/buffer_base + RTP stream restart consolidation. Also make
the codec munger creation more resilient.

* fix test
This commit is contained in:
Raja Subramanian
2026-01-08 02:35:32 +05:30
committed by GitHub
parent dafdc36e3e
commit 7fae5ac9e6
4 changed files with 17 additions and 12 deletions
-6
View File
@@ -331,7 +331,6 @@ func TestCodecChange(t *testing.T) {
buff := NewBuffer(123, 1, 1)
require.NotNil(t, buff)
changedCodec := make(chan webrtc.RTPCodecParameters, 1)
restartCleared := make(chan struct{}, 1)
buff.OnCodecChange(func(rp webrtc.RTPCodecParameters) {
select {
case changedCodec <- rp:
@@ -347,8 +346,6 @@ func TestCodecChange(t *testing.T) {
extPkt, err := buff.ReadExtended(buf[:])
require.NoError(t, err)
require.Nil(t, extPkt)
restartCleared <- struct{}{}
})
h265Pkt := rtp.Packet{
@@ -391,7 +388,6 @@ func TestCodecChange(t *testing.T) {
case <-time.After(1 * time.Second):
t.Fatalf("expected codec change")
}
<-restartCleared
// second codec change - writing VP8 packet after Bind should trigger another codec change
vp8Pkt := rtp.Packet{
@@ -416,7 +412,6 @@ func TestCodecChange(t *testing.T) {
t.Fatalf("expected codec change")
}
fmt.Printf("done second codec change\n") // REMOVE
<-restartCleared
// out of order pkts can't cause codec change
// rewrite the VP8 packet to start the sequence after a stream restart
@@ -463,7 +458,6 @@ func TestCodecChange(t *testing.T) {
case <-time.After(1 * time.Second):
t.Fatalf("expected codec change")
}
<-restartCleared
}
func BenchmarkMemcpu(b *testing.B) {