From b216d912fe849c2438ee77ce963bc16dd2121cfe Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 14:29:04 +1030 Subject: [PATCH 01/28] protocol/rtp: added parse.go file with parsing functionality Added parse.go. This file contains functionality to obtain the Payload from an RTP packet. Unexported functions to help with this extraction have been added; extHeaderLen, hasExt, csrcCount and version. --- protocol/rtp/parse.go | 88 +++++++++++++++++++++++++++++++++++++++++++ protocol/rtp/rtp.go | 9 +++-- 2 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 protocol/rtp/parse.go diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go new file mode 100644 index 00000000..d1ee487b --- /dev/null +++ b/protocol/rtp/parse.go @@ -0,0 +1,88 @@ +/* +NAME + parse.go + +DESCRIPTION + parse.go provides functionality for parsing RTP packets. + +AUTHOR + Saxon A. Nelson-Milton + +LICENSE + Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + + This is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). +*/ + +package rtp + +import ( + "encoding/binary" + "errors" +) + +const badVer = "incompatible RTP version" + +// Payload returns the payload from an RTP packet provided the version is +// compatible, otherwise an error is returned. +func Payload(d []byte) ([]byte, error) { + if version(d) != rtpVer { + return nil, errors.New(badVer) + } + extLen := 0 + if hasExt(d) { + extLen = 4 + 4*extHeaderLen(d) + } + payloadIdx := optionalFieldIdx + 4*csrcCount(d) + extLen + return d[payloadIdx:], nil +} + +// extHeaderLen returns the extension header length. The RTP packet must have +// a compatible version, and must have an extension field, otherwise we panic. +func extHeaderLen(d []byte) int { + if version(d) != rtpVer { + panic(badVer) + } + if !hasExt(d) { + panic("RTP packet does not have extension") + } + extIdx := optionalFieldIdx + 4*csrcCount(d) + return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) +} + +// hasExt returns true if an extension is present in the RTP packet. The version +// must be compatible otherwise we panic. +func hasExt(d []byte) bool { + if version(d) != rtpVer { + panic(badVer) + } + if (d[0] & 0x10 >> 4) == 1 { + return true + } + return false +} + +// csrcCount returns the number of CSRC fields. If the version is not compatible +// we panic. +func csrcCount(d []byte) int { + if version(d) != rtpVer { + panic(badVer) + } + return int(d[0] & 0x0f) +} + +// version returns the version of the RTP packet. +func version(d []byte) int { + return int(d[0] & 0xb0 >> 4) +} diff --git a/protocol/rtp/rtp.go b/protocol/rtp/rtp.go index 8b18d4ca..6550a647 100644 --- a/protocol/rtp/rtp.go +++ b/protocol/rtp/rtp.go @@ -37,10 +37,11 @@ import ( ) const ( - rtpVer = 2 - defaultHeadSize = 3 * 4 // Header size of an rtp packet. - defPayloadSize = sendSize // Default payload size for the rtp packet. - defPktSize = defaultHeadSize + defPayloadSize // Default packet size is header size + payload size. + rtpVer = 2 + defaultHeadSize = 3 * 4 // Header size of an rtp packet. + defPayloadSize = sendSize // Default payload size for the rtp packet. + defPktSize = defaultHeadSize + defPayloadSize // Default packet size is header size + payload size. + optionalFieldIdx = 12 // This is the idx of optional fields including CSRC and extension header in an RTP packet. ) // Pkt provides fields consistent with RFC3550 definition of an rtp packet From ce4b0f7ddd7515a884bcf077bb6c010f9c596f13 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 14:33:47 +1030 Subject: [PATCH 02/28] protocol/rtp: added parse_test.go file and fixed copyrights. --- protocol/rtp/parse.go | 2 +- protocol/rtp/parse_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 protocol/rtp/parse_test.go diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index d1ee487b..22a663f8 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -22,7 +22,7 @@ LICENSE for more details. You should have received a copy of the GNU General Public License - along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). + in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). */ package rtp diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go new file mode 100644 index 00000000..7c5a03e9 --- /dev/null +++ b/protocol/rtp/parse_test.go @@ -0,0 +1,28 @@ +/* +NAME + parse_test.go + +DESCRIPTION + parse_test.go provides testing for behaviour of functionality in parse.go. + +AUTHOR + Saxon A. Nelson-Milton + +LICENSE + Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + + This is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). +*/ + +package rtp From 015b1f7aa9f3c7fd0a7ceb365845f5b842c48235 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:14:32 +1030 Subject: [PATCH 03/28] protocol/rtp: wrote TestVersion Wrote test that checks the version func will correctly get the version from an RTP packet. --- protocol/rtp/parse.go | 2 +- protocol/rtp/parse_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 22a663f8..63e5dc2d 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -84,5 +84,5 @@ func csrcCount(d []byte) int { // version returns the version of the RTP packet. func version(d []byte) int { - return int(d[0] & 0xb0 >> 4) + return int(d[0] & 0xc0 >> 6) } diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 7c5a03e9..01de123d 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -26,3 +26,17 @@ LICENSE */ package rtp + +import ( + "testing" +) + +// TestVersion checks that we can correctly get the version from an RTP packet. +func TestVersion(t *testing.T) { + const expect = 1 + pkt := (&Pkt{V: expect}).Bytes(nil) + got := version(pkt) + if got != expect { + t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) + } +} From 96debea06240c2036992958995397136b4a67289 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:23:00 +1030 Subject: [PATCH 04/28] protocol/rtp: wrote TestCsrcCount Wrote test TestCsrcCount to check behaviour of csrcCount is expected. --- protocol/rtp/parse_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 01de123d..be521a3b 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -40,3 +40,18 @@ func TestVersion(t *testing.T) { t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) } } + +// TestCsrcCount checks that we can correctly obtain the csrc count from an +// RTP packet. +func TestCsrcCount(t *testing.T) { + const ver, expect = 2, 2 + pkt := (&Pkt{ + V: ver, + CC: expect, + CSRC: make([][4]byte, expect), + }).Bytes(nil) + got := csrcCount(pkt) + if got != expect { + t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) + } +} From cd9ef96648b372ac90517a4d62c4f19f976f2dbe Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:46:05 +1030 Subject: [PATCH 05/28] protocol/rtp: wrote TestHasExt Wrote test TestHasExt which checks the behaviour of hasExt for when it's call with an RTP packet with an extension indicator and also for an RTP packet with no extension indicator. --- protocol/rtp/parse_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index be521a3b..64be4ece 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -55,3 +55,30 @@ func TestCsrcCount(t *testing.T) { t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) } } + +// TestHasExt checks the behaviour of hasExt with an RTP packet that has the +// extension indicator true, and one with the extension indicator set to false. +func TestHasExt(t *testing.T) { + const ver = 2 + + // First check for when there is an extension field. + pkt := &Pkt{ + V: ver, + X: true, + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, 0), + }, + } + got := hasExt(pkt.Bytes(nil)) + if !got { + t.Error("RTP packet did not have true extension indicator as expected") + } + + // Now check when there is not an extension field. + pkt.X = false + got = hasExt(pkt.Bytes(nil)) + if got { + t.Error("did not expect to have extension indicator as true") + } +} From f4e8d3882671b4ba116bfc4da9dbe29694ce9138 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:53:22 +1030 Subject: [PATCH 06/28] protocol/rtp: added TestExtHeaderLen Added test TestExtHeaderLen which checks that extHeaderLen returns the correct len for an RTP packet with an extension header. --- protocol/rtp/parse_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 64be4ece..9af2ed0c 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -82,3 +82,20 @@ func TestHasExt(t *testing.T) { t.Error("did not expect to have extension indicator as true") } } + +// TestExtHeaderLen checks for a correct extension header len for an RTP packet. +func TestExtHeaderLen(t *testing.T) { + const ver, expect = 2, 3 + pkt := (&Pkt{ + V: ver, + X: true, + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, expect), + }, + }).Bytes(nil) + got := extHeaderLen(pkt) + if got != expect { + t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect) + } +} From d51fa5348f225c71ebf6c05fbc40dd118474e6ba Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 16:11:40 +1030 Subject: [PATCH 07/28] protocol/rtp: wrote TestPayload Wrote test TestPayload which will check that we can correctly get the payload from an RTP packet using Payload for a variety of different RTP packet configurations. --- protocol/rtp/parse_test.go | 62 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 9af2ed0c..74b770f8 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -28,14 +28,14 @@ LICENSE package rtp import ( + "bytes" "testing" ) // TestVersion checks that we can correctly get the version from an RTP packet. func TestVersion(t *testing.T) { const expect = 1 - pkt := (&Pkt{V: expect}).Bytes(nil) - got := version(pkt) + got := version((&Pkt{V: expect}).Bytes(nil)) if got != expect { t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) } @@ -45,11 +45,13 @@ func TestVersion(t *testing.T) { // RTP packet. func TestCsrcCount(t *testing.T) { const ver, expect = 2, 2 + pkt := (&Pkt{ V: ver, CC: expect, CSRC: make([][4]byte, expect), }).Bytes(nil) + got := csrcCount(pkt) if got != expect { t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) @@ -70,6 +72,7 @@ func TestHasExt(t *testing.T) { Header: make([][4]byte, 0), }, } + got := hasExt(pkt.Bytes(nil)) if !got { t.Error("RTP packet did not have true extension indicator as expected") @@ -86,6 +89,7 @@ func TestHasExt(t *testing.T) { // TestExtHeaderLen checks for a correct extension header len for an RTP packet. func TestExtHeaderLen(t *testing.T) { const ver, expect = 2, 3 + pkt := (&Pkt{ V: ver, X: true, @@ -94,8 +98,62 @@ func TestExtHeaderLen(t *testing.T) { Header: make([][4]byte, expect), }, }).Bytes(nil) + got := extHeaderLen(pkt) if got != expect { t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect) } } + +// TestPayload checks that we can correctly get the payload of an RTP packet +// using Payload for a variety of RTP packet configurations. +func TestPayload(t *testing.T) { + const ver = 2 + expect := []byte{0x01, 0x02, 0x03, 0x04, 0x05} + + testPkts := [][]byte{ + (&Pkt{ + V: ver, + Payload: expect, + }).Bytes(nil), + + (&Pkt{ + V: ver, + CC: 3, + CSRC: make([][4]byte, 3), + Payload: expect, + }).Bytes(nil), + + (&Pkt{ + V: ver, + X: true, + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, 3), + }, + Payload: expect, + }).Bytes(nil), + + (&Pkt{ + V: ver, + CC: 3, + CSRC: make([][4]byte, 3), + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, 3), + }, + Payload: expect, + }).Bytes(nil), + } + + for i, p := range testPkts { + got, err := Payload(p) + if err != nil { + t.Errorf("unexpected error from Payload with pkt: %v", i) + } + + if !bytes.Equal(got, expect) { + t.Errorf("unexpected payload data from RTP packet: %v.\n Got: %v\n Want: %v\n", i, got, expect) + } + } +} From 0d787e2dac739b906e9abf8dfc7e55c611d8853b Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 13:32:58 +0930 Subject: [PATCH 08/28] protocol/rtp: fixed indentation issue in file header --- protocol/rtp/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 63e5dc2d..92c75b0a 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -19,7 +19,7 @@ LICENSE It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + for more details. You should have received a copy of the GNU General Public License in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). From 1f5c33fc57bde0a81a7201bca283442d12fe0882 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 13:35:46 +0930 Subject: [PATCH 09/28] protocol/rtp: fixed indentation issue in file header in parse_test.go --- protocol/rtp/parse_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 74b770f8..a41e1041 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -19,7 +19,7 @@ LICENSE It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + for more details. You should have received a copy of the GNU General Public License in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). From 049930570b3b1bddac9a058204ccdf0df69b446f Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 14:50:48 +0930 Subject: [PATCH 10/28] protocol/rtp: removed redundant version checks from helper funcs in parse.go --- protocol/rtp/parse.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 92c75b0a..ede12ece 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -51,12 +51,6 @@ func Payload(d []byte) ([]byte, error) { // extHeaderLen returns the extension header length. The RTP packet must have // a compatible version, and must have an extension field, otherwise we panic. func extHeaderLen(d []byte) int { - if version(d) != rtpVer { - panic(badVer) - } - if !hasExt(d) { - panic("RTP packet does not have extension") - } extIdx := optionalFieldIdx + 4*csrcCount(d) return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) } @@ -64,9 +58,6 @@ func extHeaderLen(d []byte) int { // hasExt returns true if an extension is present in the RTP packet. The version // must be compatible otherwise we panic. func hasExt(d []byte) bool { - if version(d) != rtpVer { - panic(badVer) - } if (d[0] & 0x10 >> 4) == 1 { return true } @@ -76,9 +67,6 @@ func hasExt(d []byte) bool { // csrcCount returns the number of CSRC fields. If the version is not compatible // we panic. func csrcCount(d []byte) int { - if version(d) != rtpVer { - panic(badVer) - } return int(d[0] & 0x0f) } From 6ccb0d70d9d39d9c933641639a992d6162a86277 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 14:54:24 +0930 Subject: [PATCH 11/28] protocol/rtp: commented rtpVer const and made defaultHeadSize 12 rather than 4*3 --- protocol/rtp/rtp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/rtp/rtp.go b/protocol/rtp/rtp.go index 6550a647..c26426a9 100644 --- a/protocol/rtp/rtp.go +++ b/protocol/rtp/rtp.go @@ -37,8 +37,8 @@ import ( ) const ( - rtpVer = 2 - defaultHeadSize = 3 * 4 // Header size of an rtp packet. + rtpVer = 2 // Version of RTP that this package is compatible with. + defaultHeadSize = 12 // Header size of an rtp packet. defPayloadSize = sendSize // Default payload size for the rtp packet. defPktSize = defaultHeadSize + defPayloadSize // Default packet size is header size + payload size. optionalFieldIdx = 12 // This is the idx of optional fields including CSRC and extension header in an RTP packet. From a16ba22527e0a5c999df381b794f3c1e81d01198 Mon Sep 17 00:00:00 2001 From: Saxon Date: Mon, 8 Apr 2019 20:31:55 +0930 Subject: [PATCH 12/28] protocol/rtp: removed extHeaderLen func --- protocol/rtp/parse.go | 9 +-------- protocol/rtp/parse_test.go | 19 ------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index ede12ece..a0daf3c7 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -42,19 +42,12 @@ func Payload(d []byte) ([]byte, error) { } extLen := 0 if hasExt(d) { - extLen = 4 + 4*extHeaderLen(d) + extLen = 4 + 4*(int(binary.BigEndian.Uint16(d[optionalFieldIdx+4*csrcCount(d)+2:]))) } payloadIdx := optionalFieldIdx + 4*csrcCount(d) + extLen return d[payloadIdx:], nil } -// extHeaderLen returns the extension header length. The RTP packet must have -// a compatible version, and must have an extension field, otherwise we panic. -func extHeaderLen(d []byte) int { - extIdx := optionalFieldIdx + 4*csrcCount(d) - return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) -} - // hasExt returns true if an extension is present in the RTP packet. The version // must be compatible otherwise we panic. func hasExt(d []byte) bool { diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index a41e1041..ec779e5d 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -86,25 +86,6 @@ func TestHasExt(t *testing.T) { } } -// TestExtHeaderLen checks for a correct extension header len for an RTP packet. -func TestExtHeaderLen(t *testing.T) { - const ver, expect = 2, 3 - - pkt := (&Pkt{ - V: ver, - X: true, - Extension: ExtensionHeader{ - ID: 0, - Header: make([][4]byte, expect), - }, - }).Bytes(nil) - - got := extHeaderLen(pkt) - if got != expect { - t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect) - } -} - // TestPayload checks that we can correctly get the payload of an RTP packet // using Payload for a variety of RTP packet configurations. func TestPayload(t *testing.T) { From af9a9bc6c09c505b0d7072ff6428ac4a31437af8 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 14:29:04 +1030 Subject: [PATCH 13/28] protocol/rtp: added parse.go file with parsing functionality Added parse.go. This file contains functionality to obtain the Payload from an RTP packet. Unexported functions to help with this extraction have been added; extHeaderLen, hasExt, csrcCount and version. --- protocol/rtp/parse.go | 88 +++++++++++++++++++++++++++++++++++++++++++ protocol/rtp/rtp.go | 9 +++-- 2 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 protocol/rtp/parse.go diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go new file mode 100644 index 00000000..d1ee487b --- /dev/null +++ b/protocol/rtp/parse.go @@ -0,0 +1,88 @@ +/* +NAME + parse.go + +DESCRIPTION + parse.go provides functionality for parsing RTP packets. + +AUTHOR + Saxon A. Nelson-Milton + +LICENSE + Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + + This is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). +*/ + +package rtp + +import ( + "encoding/binary" + "errors" +) + +const badVer = "incompatible RTP version" + +// Payload returns the payload from an RTP packet provided the version is +// compatible, otherwise an error is returned. +func Payload(d []byte) ([]byte, error) { + if version(d) != rtpVer { + return nil, errors.New(badVer) + } + extLen := 0 + if hasExt(d) { + extLen = 4 + 4*extHeaderLen(d) + } + payloadIdx := optionalFieldIdx + 4*csrcCount(d) + extLen + return d[payloadIdx:], nil +} + +// extHeaderLen returns the extension header length. The RTP packet must have +// a compatible version, and must have an extension field, otherwise we panic. +func extHeaderLen(d []byte) int { + if version(d) != rtpVer { + panic(badVer) + } + if !hasExt(d) { + panic("RTP packet does not have extension") + } + extIdx := optionalFieldIdx + 4*csrcCount(d) + return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) +} + +// hasExt returns true if an extension is present in the RTP packet. The version +// must be compatible otherwise we panic. +func hasExt(d []byte) bool { + if version(d) != rtpVer { + panic(badVer) + } + if (d[0] & 0x10 >> 4) == 1 { + return true + } + return false +} + +// csrcCount returns the number of CSRC fields. If the version is not compatible +// we panic. +func csrcCount(d []byte) int { + if version(d) != rtpVer { + panic(badVer) + } + return int(d[0] & 0x0f) +} + +// version returns the version of the RTP packet. +func version(d []byte) int { + return int(d[0] & 0xb0 >> 4) +} diff --git a/protocol/rtp/rtp.go b/protocol/rtp/rtp.go index 33a3e7f8..81278236 100644 --- a/protocol/rtp/rtp.go +++ b/protocol/rtp/rtp.go @@ -37,10 +37,11 @@ import ( ) const ( - rtpVer = 2 - defaultHeadSize = 3 * 4 // Header size of an rtp packet. - defPayloadSize = sendSize // Default payload size for the rtp packet. - defPktSize = defaultHeadSize + defPayloadSize // Default packet size is header size + payload size. + rtpVer = 2 + defaultHeadSize = 3 * 4 // Header size of an rtp packet. + defPayloadSize = sendSize // Default payload size for the rtp packet. + defPktSize = defaultHeadSize + defPayloadSize // Default packet size is header size + payload size. + optionalFieldIdx = 12 // This is the idx of optional fields including CSRC and extension header in an RTP packet. ) // Pkt provides fields consistent with RFC3550 definition of an rtp packet From fa9888723f2de3bbdab61f0e6a88ae5a21719c79 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 14:33:47 +1030 Subject: [PATCH 14/28] protocol/rtp: added parse_test.go file and fixed copyrights. --- protocol/rtp/parse.go | 2 +- protocol/rtp/parse_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 protocol/rtp/parse_test.go diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index d1ee487b..22a663f8 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -22,7 +22,7 @@ LICENSE for more details. You should have received a copy of the GNU General Public License - along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). + in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). */ package rtp diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go new file mode 100644 index 00000000..7c5a03e9 --- /dev/null +++ b/protocol/rtp/parse_test.go @@ -0,0 +1,28 @@ +/* +NAME + parse_test.go + +DESCRIPTION + parse_test.go provides testing for behaviour of functionality in parse.go. + +AUTHOR + Saxon A. Nelson-Milton + +LICENSE + Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + + This is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). +*/ + +package rtp From 74b25e646ab3dbf9154ebf81dc794a8ea6d845c5 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:14:32 +1030 Subject: [PATCH 15/28] protocol/rtp: wrote TestVersion Wrote test that checks the version func will correctly get the version from an RTP packet. --- protocol/rtp/parse.go | 2 +- protocol/rtp/parse_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 22a663f8..63e5dc2d 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -84,5 +84,5 @@ func csrcCount(d []byte) int { // version returns the version of the RTP packet. func version(d []byte) int { - return int(d[0] & 0xb0 >> 4) + return int(d[0] & 0xc0 >> 6) } diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 7c5a03e9..01de123d 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -26,3 +26,17 @@ LICENSE */ package rtp + +import ( + "testing" +) + +// TestVersion checks that we can correctly get the version from an RTP packet. +func TestVersion(t *testing.T) { + const expect = 1 + pkt := (&Pkt{V: expect}).Bytes(nil) + got := version(pkt) + if got != expect { + t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) + } +} From c2b67d7fb916d7dfb2e869212449cf14a27e0972 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:23:00 +1030 Subject: [PATCH 16/28] protocol/rtp: wrote TestCsrcCount Wrote test TestCsrcCount to check behaviour of csrcCount is expected. --- protocol/rtp/parse_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 01de123d..be521a3b 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -40,3 +40,18 @@ func TestVersion(t *testing.T) { t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) } } + +// TestCsrcCount checks that we can correctly obtain the csrc count from an +// RTP packet. +func TestCsrcCount(t *testing.T) { + const ver, expect = 2, 2 + pkt := (&Pkt{ + V: ver, + CC: expect, + CSRC: make([][4]byte, expect), + }).Bytes(nil) + got := csrcCount(pkt) + if got != expect { + t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) + } +} From 3dc6d7733bcce28d0202f1b38a77690249bd4deb Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:46:05 +1030 Subject: [PATCH 17/28] protocol/rtp: wrote TestHasExt Wrote test TestHasExt which checks the behaviour of hasExt for when it's call with an RTP packet with an extension indicator and also for an RTP packet with no extension indicator. --- protocol/rtp/parse_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index be521a3b..64be4ece 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -55,3 +55,30 @@ func TestCsrcCount(t *testing.T) { t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) } } + +// TestHasExt checks the behaviour of hasExt with an RTP packet that has the +// extension indicator true, and one with the extension indicator set to false. +func TestHasExt(t *testing.T) { + const ver = 2 + + // First check for when there is an extension field. + pkt := &Pkt{ + V: ver, + X: true, + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, 0), + }, + } + got := hasExt(pkt.Bytes(nil)) + if !got { + t.Error("RTP packet did not have true extension indicator as expected") + } + + // Now check when there is not an extension field. + pkt.X = false + got = hasExt(pkt.Bytes(nil)) + if got { + t.Error("did not expect to have extension indicator as true") + } +} From 275b86285ed15f4122c790b631d76ac3582d4fd7 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:53:22 +1030 Subject: [PATCH 18/28] protocol/rtp: added TestExtHeaderLen Added test TestExtHeaderLen which checks that extHeaderLen returns the correct len for an RTP packet with an extension header. --- protocol/rtp/parse_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 64be4ece..9af2ed0c 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -82,3 +82,20 @@ func TestHasExt(t *testing.T) { t.Error("did not expect to have extension indicator as true") } } + +// TestExtHeaderLen checks for a correct extension header len for an RTP packet. +func TestExtHeaderLen(t *testing.T) { + const ver, expect = 2, 3 + pkt := (&Pkt{ + V: ver, + X: true, + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, expect), + }, + }).Bytes(nil) + got := extHeaderLen(pkt) + if got != expect { + t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect) + } +} From 3dfc7ed990eeade6ef0d81f6efb8dac09426a3c2 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 16:11:40 +1030 Subject: [PATCH 19/28] protocol/rtp: wrote TestPayload Wrote test TestPayload which will check that we can correctly get the payload from an RTP packet using Payload for a variety of different RTP packet configurations. --- protocol/rtp/parse_test.go | 62 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 9af2ed0c..74b770f8 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -28,14 +28,14 @@ LICENSE package rtp import ( + "bytes" "testing" ) // TestVersion checks that we can correctly get the version from an RTP packet. func TestVersion(t *testing.T) { const expect = 1 - pkt := (&Pkt{V: expect}).Bytes(nil) - got := version(pkt) + got := version((&Pkt{V: expect}).Bytes(nil)) if got != expect { t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) } @@ -45,11 +45,13 @@ func TestVersion(t *testing.T) { // RTP packet. func TestCsrcCount(t *testing.T) { const ver, expect = 2, 2 + pkt := (&Pkt{ V: ver, CC: expect, CSRC: make([][4]byte, expect), }).Bytes(nil) + got := csrcCount(pkt) if got != expect { t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) @@ -70,6 +72,7 @@ func TestHasExt(t *testing.T) { Header: make([][4]byte, 0), }, } + got := hasExt(pkt.Bytes(nil)) if !got { t.Error("RTP packet did not have true extension indicator as expected") @@ -86,6 +89,7 @@ func TestHasExt(t *testing.T) { // TestExtHeaderLen checks for a correct extension header len for an RTP packet. func TestExtHeaderLen(t *testing.T) { const ver, expect = 2, 3 + pkt := (&Pkt{ V: ver, X: true, @@ -94,8 +98,62 @@ func TestExtHeaderLen(t *testing.T) { Header: make([][4]byte, expect), }, }).Bytes(nil) + got := extHeaderLen(pkt) if got != expect { t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect) } } + +// TestPayload checks that we can correctly get the payload of an RTP packet +// using Payload for a variety of RTP packet configurations. +func TestPayload(t *testing.T) { + const ver = 2 + expect := []byte{0x01, 0x02, 0x03, 0x04, 0x05} + + testPkts := [][]byte{ + (&Pkt{ + V: ver, + Payload: expect, + }).Bytes(nil), + + (&Pkt{ + V: ver, + CC: 3, + CSRC: make([][4]byte, 3), + Payload: expect, + }).Bytes(nil), + + (&Pkt{ + V: ver, + X: true, + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, 3), + }, + Payload: expect, + }).Bytes(nil), + + (&Pkt{ + V: ver, + CC: 3, + CSRC: make([][4]byte, 3), + Extension: ExtensionHeader{ + ID: 0, + Header: make([][4]byte, 3), + }, + Payload: expect, + }).Bytes(nil), + } + + for i, p := range testPkts { + got, err := Payload(p) + if err != nil { + t.Errorf("unexpected error from Payload with pkt: %v", i) + } + + if !bytes.Equal(got, expect) { + t.Errorf("unexpected payload data from RTP packet: %v.\n Got: %v\n Want: %v\n", i, got, expect) + } + } +} From b5711d18c53fb97aa8b685639926e66e72df7d67 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 13:32:58 +0930 Subject: [PATCH 20/28] protocol/rtp: fixed indentation issue in file header --- protocol/rtp/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 63e5dc2d..92c75b0a 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -19,7 +19,7 @@ LICENSE It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + for more details. You should have received a copy of the GNU General Public License in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). From 09b8a2baffdb4d5c5f8697e8b2d05b397c2ee8eb Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 13:35:46 +0930 Subject: [PATCH 21/28] protocol/rtp: fixed indentation issue in file header in parse_test.go --- protocol/rtp/parse_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 74b770f8..a41e1041 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -19,7 +19,7 @@ LICENSE It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + for more details. You should have received a copy of the GNU General Public License in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). From df3e66e5b2d1c2f59c914c2b476012c0aa4610c3 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 14:50:48 +0930 Subject: [PATCH 22/28] protocol/rtp: removed redundant version checks from helper funcs in parse.go --- protocol/rtp/parse.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 92c75b0a..ede12ece 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -51,12 +51,6 @@ func Payload(d []byte) ([]byte, error) { // extHeaderLen returns the extension header length. The RTP packet must have // a compatible version, and must have an extension field, otherwise we panic. func extHeaderLen(d []byte) int { - if version(d) != rtpVer { - panic(badVer) - } - if !hasExt(d) { - panic("RTP packet does not have extension") - } extIdx := optionalFieldIdx + 4*csrcCount(d) return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) } @@ -64,9 +58,6 @@ func extHeaderLen(d []byte) int { // hasExt returns true if an extension is present in the RTP packet. The version // must be compatible otherwise we panic. func hasExt(d []byte) bool { - if version(d) != rtpVer { - panic(badVer) - } if (d[0] & 0x10 >> 4) == 1 { return true } @@ -76,9 +67,6 @@ func hasExt(d []byte) bool { // csrcCount returns the number of CSRC fields. If the version is not compatible // we panic. func csrcCount(d []byte) int { - if version(d) != rtpVer { - panic(badVer) - } return int(d[0] & 0x0f) } From b5c018276f2126b40edc3f5173022e500a42852e Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 14:54:24 +0930 Subject: [PATCH 23/28] protocol/rtp: commented rtpVer const and made defaultHeadSize 12 rather than 4*3 --- protocol/rtp/rtp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/rtp/rtp.go b/protocol/rtp/rtp.go index 81278236..73f6f15b 100644 --- a/protocol/rtp/rtp.go +++ b/protocol/rtp/rtp.go @@ -37,8 +37,8 @@ import ( ) const ( - rtpVer = 2 - defaultHeadSize = 3 * 4 // Header size of an rtp packet. + rtpVer = 2 // Version of RTP that this package is compatible with. + defaultHeadSize = 12 // Header size of an rtp packet. defPayloadSize = sendSize // Default payload size for the rtp packet. defPktSize = defaultHeadSize + defPayloadSize // Default packet size is header size + payload size. optionalFieldIdx = 12 // This is the idx of optional fields including CSRC and extension header in an RTP packet. From 6992ab395b32b89c27ef136b5a650c3182b38f6a Mon Sep 17 00:00:00 2001 From: Saxon Date: Mon, 8 Apr 2019 20:31:55 +0930 Subject: [PATCH 24/28] protocol/rtp: removed extHeaderLen func --- protocol/rtp/parse.go | 9 +-------- protocol/rtp/parse_test.go | 19 ------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index ede12ece..a0daf3c7 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -42,19 +42,12 @@ func Payload(d []byte) ([]byte, error) { } extLen := 0 if hasExt(d) { - extLen = 4 + 4*extHeaderLen(d) + extLen = 4 + 4*(int(binary.BigEndian.Uint16(d[optionalFieldIdx+4*csrcCount(d)+2:]))) } payloadIdx := optionalFieldIdx + 4*csrcCount(d) + extLen return d[payloadIdx:], nil } -// extHeaderLen returns the extension header length. The RTP packet must have -// a compatible version, and must have an extension field, otherwise we panic. -func extHeaderLen(d []byte) int { - extIdx := optionalFieldIdx + 4*csrcCount(d) - return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) -} - // hasExt returns true if an extension is present in the RTP packet. The version // must be compatible otherwise we panic. func hasExt(d []byte) bool { diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index a41e1041..ec779e5d 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -86,25 +86,6 @@ func TestHasExt(t *testing.T) { } } -// TestExtHeaderLen checks for a correct extension header len for an RTP packet. -func TestExtHeaderLen(t *testing.T) { - const ver, expect = 2, 3 - - pkt := (&Pkt{ - V: ver, - X: true, - Extension: ExtensionHeader{ - ID: 0, - Header: make([][4]byte, expect), - }, - }).Bytes(nil) - - got := extHeaderLen(pkt) - if got != expect { - t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect) - } -} - // TestPayload checks that we can correctly get the payload of an RTP packet // using Payload for a variety of RTP packet configurations. func TestPayload(t *testing.T) { From ff0c62910c482d79c6123acf4501a6e5e1bf750d Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 10 Apr 2019 12:51:05 +0930 Subject: [PATCH 25/28] protcol/rtp: panic in Payload if length is not sufficiently long to be RTP packet. --- protocol/rtp/parse.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index a0daf3c7..06a5d41b 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -37,6 +37,9 @@ const badVer = "incompatible RTP version" // Payload returns the payload from an RTP packet provided the version is // compatible, otherwise an error is returned. func Payload(d []byte) ([]byte, error) { + if len(d) < defaultHeadSize { + panic("invalid RTP packet length") + } if version(d) != rtpVer { return nil, errors.New(badVer) } From a0fb380717c61c5e545b7f7d85cb6f72a2cb88c0 Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 10 Apr 2019 12:52:05 +0930 Subject: [PATCH 26/28] protocol/rtp: simplified hasExt function --- protocol/rtp/parse.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 06a5d41b..121364cf 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -54,10 +54,7 @@ func Payload(d []byte) ([]byte, error) { // hasExt returns true if an extension is present in the RTP packet. The version // must be compatible otherwise we panic. func hasExt(d []byte) bool { - if (d[0] & 0x10 >> 4) == 1 { - return true - } - return false + return (d[0] & 0x10 >> 4) == 1 } // csrcCount returns the number of CSRC fields. If the version is not compatible From 0700a8270dd800e94c8dc420f11853a8041c0757 Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 10 Apr 2019 16:56:32 +0930 Subject: [PATCH 27/28] protocol/rtp: updated parse.go function comments --- protocol/rtp/parse.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 121364cf..8642385c 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -51,14 +51,12 @@ func Payload(d []byte) ([]byte, error) { return d[payloadIdx:], nil } -// hasExt returns true if an extension is present in the RTP packet. The version -// must be compatible otherwise we panic. +// hasExt returns true if an extension is present in the RTP packet. func hasExt(d []byte) bool { return (d[0] & 0x10 >> 4) == 1 } -// csrcCount returns the number of CSRC fields. If the version is not compatible -// we panic. +// csrcCount returns the number of CSRC fields. func csrcCount(d []byte) int { return int(d[0] & 0x0f) } From 4a613e600c334af8c0d201616b320013803ecffc Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 14 Apr 2019 17:08:42 +0930 Subject: [PATCH 28/28] protocol/rtp: fixed gnu license url in file headers for parse_test.go and parse.go --- protocol/rtp/parse.go | 2 +- protocol/rtp/parse_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 8642385c..d658aa20 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -22,7 +22,7 @@ LICENSE for more details. You should have received a copy of the GNU General Public License - in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). + in gpl.txt. If not, see http://www.gnu.org/licenses. */ package rtp diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index ec779e5d..f3468c57 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -22,7 +22,7 @@ LICENSE for more details. You should have received a copy of the GNU General Public License - in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). + in gpl.txt. If not, see http://www.gnu.org/licenses. */ package rtp