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:
Sean DuBois
2018-09-22 14:39:12 -07:00
parent 75b59db8f0
commit f7c4fea4f5
6 changed files with 30 additions and 10 deletions

View File

@@ -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 {