Beispiel #1
0
 def testParseShowSDP(self):
     from shtoom.sdp import SDP
     ae = self.assertEqual
     sdp1 = SDP(sdptext1)
     audio1 = sdp1.getMediaDescription('audio')
     ae(audio1.rtpmap.keys(), [0,3])
     video1 = sdp1.getMediaDescription('video')
     ae(video1.rtpmap.keys(), [31])
     self.assertEquals(sdp1.show(), sdptext1)
Beispiel #2
0
 def testParseShowSDP(self):
     from shtoom.sdp import SDP
     ae = self.assertEqual
     sdp1 = SDP(sdptext1)
     audio1 = sdp1.getMediaDescription('audio')
     ae(audio1.rtpmap.keys(), [0, 3])
     video1 = sdp1.getMediaDescription('video')
     ae(video1.rtpmap.keys(), [31])
     self.assertEquals(sdp1.show(), sdptext1)
Beispiel #3
0
 def testIntersectSDP(self):
     from shtoom.sdp import SDP
     ae = self.assertEqual
     sdp1 = SDP(sdptext1)
     ae(sdp1.show(), sdptext1)
     sdp2 = SDP(sdptext2)
     sdp1.intersect(sdp2)
     sdp3 = SDP(sdptext3)
     #ae(sdp1.show(), sdp3.show())
     audio1 = sdp1.getMediaDescription('audio')
     audio3 = sdp3.getMediaDescription('audio')
     ae(audio1.formats, audio3.formats)
     ae(audio1.rtpmap.keys(), [3,])
Beispiel #4
0
 def testOLDSimpleSDP(self):
     from shtoom.multicast.SDP import SDP, SimpleSDP
     s = SimpleSDP()
     s.setServerIP('10.11.12.13')
     s.setLocalPort(1234)
     s.addRtpMap('PCMU', 8000)
     s.addRtpMap('GSM', 8000)
     sdpin = s.show()
     sdpout = SDP(sdpin)
     ae = self.assertEquals
     ae(sdpout.port, 1234)
     ae(sdpout.ipaddr, '10.11.12.13')
     ae(sdpout.get('a', 'rtpmap'), ['0 PCMU/8000/1', '3 GSM/8000/1'])
     ae(sdpout.formats, [0, 3])
     ae(sdpout.media, 'audio')
     ae(sdpout.transport, 'RTP/AVP')
Beispiel #5
0
 def testOLDSimpleSDP(self):
     from shtoom.multicast.SDP import SDP, SimpleSDP
     s = SimpleSDP()
     s.setServerIP('10.11.12.13')
     s.setLocalPort(1234)
     s.addRtpMap('PCMU', 8000)
     s.addRtpMap('GSM', 8000)
     sdpin = s.show()
     sdpout = SDP(sdpin)
     ae = self.assertEquals
     ae(sdpout.port, 1234)
     ae(sdpout.ipaddr, '10.11.12.13')
     ae(sdpout.get('a', 'rtpmap'), ['0 PCMU/8000/1', '3 GSM/8000/1'])
     ae(sdpout.formats, [0,3])
     ae(sdpout.media, 'audio')
     ae(sdpout.transport, 'RTP/AVP')
Beispiel #6
0
    def testSDPCreation(self):
        from shtoom.sdp import SDP, MediaDescription
        from shtoom.rtp.formats import PT_PCMU, PT_SPEEX, PT_NTE, PT_CN
        ae = self.assertEquals

        s = SDP()
        md = MediaDescription()
        s.addMediaDescription(md)
        s.setServerIP('127.0.0.1')
        md.setServerIP('127.0.0.1')
        md.setLocalPort(45678)
        md.addRtpMap(PT_PCMU)
        md.addRtpMap(PT_SPEEX)
        md.addRtpMap(PT_CN)
        md.addRtpMap(PT_NTE)
        pts = [ x[1] for x in md.rtpmap.values() ]
        ae(pts, [PT_PCMU, PT_SPEEX, PT_CN, PT_NTE])
Beispiel #7
0
 def testIntersectSDP(self):
     from shtoom.sdp import SDP
     ae = self.assertEquals
     sdp1 = SDP(sdptext1)
     ae(sdp1.show(), sdptext1)
     sdp2 = SDP(sdptext2)
     sdp1.intersect(sdp2)
     sdp3 = SDP(sdptext3)
     #ae(sdp1.show(), sdp3.show())
     audio1 = sdp1.getMediaDescription('audio')
     audio3 = sdp3.getMediaDescription('audio')
     ae(audio1.formats, audio3.formats)
     ae(audio1.rtpmap.keys(), [3,])
Beispiel #8
0
    def testSDPCreation(self):
        from shtoom.sdp import SDP, MediaDescription
        from shtoom.rtp.formats import PT_PCMU, PT_SPEEX, PT_NTE, PT_CN
        ae = self.assertEquals

        s = SDP()
        md = MediaDescription()
        s.addMediaDescription(md)
        s.setServerIP('127.0.0.1')
        md.setServerIP('127.0.0.1')
        md.setLocalPort(45678)
        md.addRtpMap(PT_PCMU)
        md.addRtpMap(PT_SPEEX)
        md.addRtpMap(PT_CN)
        md.addRtpMap(PT_NTE)
        pts = [x[1] for x in md.rtpmap.values()]
        ae(pts, [PT_PCMU, PT_SPEEX, PT_CN, PT_NTE])
Beispiel #9
0
 def testComplexIntersectSDP(self):
     from shtoom.sdp import SDP
     from shtoom.rtp.formats import PT_SPEEX, PT_SPEEX_16K, PT_GSM, PT_PCMU
     sdp4 = SDP(sdptext4)
     ae = self.assertEquals
     ae(sdp4.show(), sdptext4)
     rtpmap = sdp4.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 101])
     sdp5 = SDP(sdptext5)
     rtpmap = sdp5.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [0, 3, 101, 102])
     ae(sdp5.show(), sdptext5)
     sdp4.intersect(sdp5)
     rtpmap = sdp4.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 102])
     sdp6 = SDP(sdptext6)
     rtpmap = sdp6.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 101, 102])
     sdp7 = SDP(sdptext7)
     rtpmap = sdp7.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [0, 3, 101, 102])
     sdp6.intersect(sdp7)
     rtpmap = sdp6.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 101, 102])
     ae(rtpmap[3][1], PT_GSM)
     ae(rtpmap[101][1], PT_SPEEX)
     ae(rtpmap[102][1], PT_SPEEX_16K)
Beispiel #10
0
 def testComplexIntersectSDP(self):
     from shtoom.sdp import SDP
     from shtoom.rtp.formats import PT_SPEEX, PT_SPEEX_16K, PT_GSM, PT_PCMU
     sdp4 = SDP(sdptext4)
     ae = self.assertEquals
     ae(sdp4.show(), sdptext4)
     rtpmap = sdp4.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 101])
     sdp5 = SDP(sdptext5)
     rtpmap = sdp5.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [0, 3, 101, 102])
     ae(sdp5.show(), sdptext5)
     sdp4.intersect(sdp5)
     rtpmap = sdp4.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 102])
     sdp6 = SDP(sdptext6)
     rtpmap = sdp6.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 101, 102])
     sdp7 = SDP(sdptext7)
     rtpmap = sdp7.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [0, 3, 101, 102])
     sdp6.intersect(sdp7)
     rtpmap = sdp6.getMediaDescription('audio').rtpmap
     ae(rtpmap.keys(), [3, 101, 102])
     ae(rtpmap[3][1], PT_GSM)
     ae(rtpmap[101][1], PT_SPEEX)
     ae(rtpmap[102][1], PT_SPEEX_16K)