mirror of
https://github.com/pion/mediadevices.git
synced 2025-10-05 16:46:51 +08:00
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:
@@ -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,
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user