hdiniz / rtpdump Goto Github PK
View Code? Open in Web Editor NEWExtract audio file from RTP streams in pcap format
License: MIT License
Extract audio file from RTP streams in pcap format
License: MIT License
isLastFrame := (rtpFrameHeader[0]&0x08)>>4&0x01 == 0x00
should be instead isLastFrame := (rtpFrameHeader[0]&0x08)>>3&0x01 == 0x00
That is, it should be shifted by 3 positions not by 4.
Also what is the point of &0x01?
Best regards.
It looks like if the pcap file contains VLAN tag, the program wounld not work. The RtpCapureFilter in rtplayer.go set to not support VLAN. Change the Filter string "vlan and udp" seems to work. Hopefully you can try to fix it.
This is probably just a lack of documentation. The README just says "Linux should be straightforward." however this requires setting GOPATH (which was never required by any previous golang programs I've compiled & run) and even when I tracked that down and fixed it, compilation still fails with what looks like dependencies.
$ go build
main.go:9:2: cannot find package "github.com/hdiniz/rtpdump/codecs" in any of:
/usr/lib/go-1.6/src/github.com/hdiniz/rtpdump/codecs (from $GOROOT)
/home/anon/go/src/github.com/hdiniz/rtpdump/codecs (from $GOPATH)
main.go:10:2: cannot find package "github.com/hdiniz/rtpdump/console" in any of:
/usr/lib/go-1.6/src/github.com/hdiniz/rtpdump/console (from $GOROOT)
/home/anon/go/src/github.com/hdiniz/rtpdump/console (from $GOPATH)
main.go:11:2: cannot find package "github.com/hdiniz/rtpdump/esp" in any of:
/usr/lib/go-1.6/src/github.com/hdiniz/rtpdump/esp (from $GOROOT)
/home/anon/go/src/github.com/hdiniz/rtpdump/esp (from $GOPATH)
main.go:12:2: cannot find package "github.com/hdiniz/rtpdump/log" in any of:
/usr/lib/go-1.6/src/github.com/hdiniz/rtpdump/log (from $GOROOT)
/home/anon/go/src/github.com/hdiniz/rtpdump/log (from $GOPATH)
main.go:13:2: cannot find package "github.com/hdiniz/rtpdump/rtp" in any of:
/usr/lib/go-1.6/src/github.com/hdiniz/rtpdump/rtp (from $GOROOT)
/home/anon/go/src/github.com/hdiniz/rtpdump/rtp (from $GOPATH)
main.go:14:2: cannot find package "github.com/urfave/cli" in any of:
/usr/lib/go-1.6/src/github.com/urfave/cli (from $GOROOT)
/home/anon/go/src/github.com/urfave/cli (from $GOPATH)
I'm told setting GOROOT is a bad idea (https://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really). I'm running Ubuntu 16.04 LTS, and go 1.6.2. I did go build
gopacket before attempting to build this package and it completed without any errors.
If we can get the build working, I'd be happy to contribute a patch to the README file.
hi, 我找到一个bug, SequenceNumber 是uint16,不断增加的, 最大值是 65535, 到65535后会溢出, 又从0开始.
func (r *RtpStream) AddPacket(rtp *RtpPacket) {
if r.CurSeq == 65535 {
r.CurSeq = 0
}
if rtp.SequenceNumber <= r.CurSeq {
return
}
r.EndTime = rtp.ReceivedAt
r.CurSeq = rtp.SequenceNumber
r.TotalExpectedPackets = uint(r.CurSeq - r.FirstSeq)
r.LostPackets = r.TotalExpectedPackets - uint(len(r.RtpPackets))
r.RtpPackets = append(r.RtpPackets, rtp)
}
Commands:
mkdir /tmp/godir
export GOPATH=/tmp/godir
go get github.com/hdiniz/rtpdump
Output:
# github.com/hdiniz/rtpdump
godir/src/github.com/hdiniz/rtpdump/main.go:19:26: c.GlobalString undefined (type *cli.Context has no field or method GlobalString)
godir/src/github.com/hdiniz/rtpdump/main.go:204:10: undefined: cli.NewMultiError
godir/src/github.com/hdiniz/rtpdump/main.go:218:10: undefined: cli.NewMultiError
godir/src/github.com/hdiniz/rtpdump/main.go:238:11: undefined: cli.NewMultiError
godir/src/github.com/hdiniz/rtpdump/main.go:246:10: undefined: cli.NewMultiError
godir/src/github.com/hdiniz/rtpdump/main.go:304:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment
godir/src/github.com/hdiniz/rtpdump/main.go:326:19: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
godir/src/github.com/hdiniz/rtpdump/main.go:327:16: cannot use cli.IntFlag literal (type cli.IntFlag) as type cli.Flag in array or slice literal:
cli.IntFlag does not implement cli.Flag (Apply method has pointer receiver)
godir/src/github.com/hdiniz/rtpdump/main.go:335:16: cannot use cli.Command literal (type cli.Command) as type *cli.Command in array or slice literal
godir/src/github.com/hdiniz/rtpdump/main.go:345:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
godir/src/github.com/hdiniz/rtpdump/main.go:345:17: too many errors
In codecs/amr.go HandleRtpPacket:
if packet.SequenceNumber <= amr.lastSeq { return nil, errors.New("Ignore out of sequence") }
However this check should consider the sequence number wrapping around. The sequence number is a 16bit unsigned number and its initial value (the sequence number of the first RTP packet) is random.
I see that lastSeq is never set, it is always 0. So, the above check is always false. When lastSeq will be set, the sequence number wrapping around should be considered.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.