mirror of
https://github.com/pion/webrtc.git
synced 2025-11-02 19:44:01 +08:00
Add RTP Depackatization to SampleBuilder
When constructing a SampleBuilder the caller now passes in a Depacketizer. This allows the SampleBuilder to take a RTP packet to a sample. This wasn't possible before because RTP payloads may carry codec specific metadata in the payloads that need to be stripped Relates to #63
This commit is contained in:
@@ -15,6 +15,13 @@ type sampleBuilderTest struct {
|
||||
bufferSize uint16
|
||||
}
|
||||
|
||||
type fakeDepacketizer struct {
|
||||
}
|
||||
|
||||
func (f *fakeDepacketizer) Unmarshal(packet *rtp.Packet) ([]byte, error) {
|
||||
return packet.Payload, nil
|
||||
}
|
||||
|
||||
var testCases = []sampleBuilderTest{
|
||||
{
|
||||
message: "SampleBuilder shouldn't emit anything if only one RTP packet has been pushed",
|
||||
@@ -83,7 +90,7 @@ func TestSampleBuilder(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
for _, t := range testCases {
|
||||
s := New(t.bufferSize)
|
||||
s := New(t.bufferSize, &fakeDepacketizer{})
|
||||
samples := []*media.RTCSample{}
|
||||
|
||||
for _, p := range t.packets {
|
||||
|
||||
Reference in New Issue
Block a user