add trace

master v1.0.4
Baik S. Hyun 4 years ago
parent 7b3e1a93c7
commit ee8df85913

@ -127,7 +127,7 @@ func (self *Handlers) NewAudioDecoder(codec av.AudioCodecData) (dec av.AudioDeco
} }
func (self *Handlers) Open(uri string) (demuxer av.DemuxCloser, err error) { func (self *Handlers) Open(uri string) (demuxer av.DemuxCloser, err error) {
util.PrintCallTrace(1) util.PrintCallTrace(1, "Handlers.Open")
listen := false listen := false
if strings.HasPrefix(uri, "listen:") { if strings.HasPrefix(uri, "listen:") {
@ -135,6 +135,8 @@ func (self *Handlers) Open(uri string) (demuxer av.DemuxCloser, err error) {
listen = true listen = true
} }
util.PrintCallTrace(1, "Handlers.Open")
for _, handler := range self.handlers { for _, handler := range self.handlers {
if listen { if listen {
if handler.ServerDemuxer != nil { if handler.ServerDemuxer != nil {
@ -272,8 +274,7 @@ func (self *Handlers) FindCreate(uri string) (handler RegisterHandler, muxer av.
var DefaultHandlers = &Handlers{} var DefaultHandlers = &Handlers{}
func Open(url string) (demuxer av.DemuxCloser, err error) { func Open(url string) (demuxer av.DemuxCloser, err error) {
fmt.Println("avutil Open!") util.PrintCallTrace(1, "avutil Open!")
util.PrintCallTrace(1)
return DefaultHandlers.Open(url) return DefaultHandlers.Open(url)
} }

@ -5,9 +5,9 @@ import (
"runtime" "runtime"
) )
func PrintCallTrace(depth int) { func PrintCallTrace(depth int, v interface{}) {
funcname, file, line, ok := runtime.Caller(depth) funcname, file, line, ok := runtime.Caller(depth)
if ok { if ok {
fmt.Printf("[%s:%d %s]\n", file, line, runtime.FuncForPC(funcname).Name()) fmt.Printf("[%s:%d %s] %v\n", file, line, runtime.FuncForPC(funcname).Name(), v)
} }
} }

Loading…
Cancel
Save