Allow double close of codecs (#364)

Video/AudioTrack.NewRTPReader() internally closes encoder on error.
It caused double free if user closes reader after error.
This commit is contained in:
Atsushi Watanabe
2021-11-21 22:57:50 +09:00
committed by GitHub
parent 1f313a9d61
commit a88c2daf89
12 changed files with 147 additions and 1 deletions

View File

@@ -51,6 +51,20 @@ func TestEncoder(t *testing.T) {
),
)
})
t.Run("CloseTwice", func(t *testing.T) {
p, err := factory()
if err != nil {
t.Fatal(err)
}
codectest.VideoEncoderCloseTwiceTest(t, p, prop.Media{
Video: prop.Video{
Width: 640,
Height: 480,
FrameRate: 30,
FrameFormat: frame.FormatI420,
},
})
})
})
}
}