Giter Club home page Giter Club logo

Comments (5)

at-wat avatar at-wat commented on July 23, 2024

It also cause segmentation fault:

$ PION_LOG_TRACE=all go test . -v -race
=== RUN   TestMain
=== RUN   TestMain/WithSTUN
ice WARNING: 2020/02/11 17:16:24 could not get server reflexive address udp6 stun:stun.l.google.com:19302: read udp6 [::]:58962: i/o timeout
    TestMain/WithSTUN: main_test.go:51: read timeout
ice INFO: 2020/02/11 17:16:34 Setting new connection state: Closed
pc INFO: 2020/02/11 17:16:34 peer connection state changed: closed
=== RUN   TestMain/WithoutSTUN
ice INFO: 2020/02/11 17:16:45 Setting new connection state: Closed
pc INFO: 2020/02/11 17:16:45 peer connection state changed: closed
unexpected fault address 0x7ff455be7152
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7ff455be7152 pc=0x618a10]

goroutine 62 [running]:
runtime.throw(0xb84a7e, 0x5)
	/usr/lib/golang114/src/runtime/panic.go:1112 +0x72 fp=0xc0000a29b8 sp=0xc0000a2988 pc=0x467f52
runtime.sigpanic()
	/usr/lib/golang114/src/runtime/signal_unix.go:694 +0x3cc fp=0xc0000a29e8 sp=0xc0000a29b8 pc=0x47fa5c
github.com/pion/mediadevices/pkg/frame.decodeYUY2(0x7ff455bae000, 0x96000, 0x96000, 0x280, 0x1e0, 0x0, 0x0, 0x400000005, 0x96000)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/frame/yuv.go:71 +0x320 fp=0xc0000a2ae8 sp=0xc0000a29e8 pc=0x618a10
github.com/pion/mediadevices/pkg/frame.DecoderFunc.Decode(0xba5628, 0x7ff455bae000, 0x96000, 0x96000, 0x280, 0x1e0, 0x0, 0x0, 0xc00000e060, 0x20)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/frame/frame.go:13 +0x79 fp=0xc0000a2b60 sp=0xc0000a2ae8 pc=0x617aa9
github.com/pion/mediadevices/pkg/driver/camera.(*camera).VideoRecord.func1(0x6087f5, 0x203000, 0x203000, 0x478ff7)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/driver/camera/camera_linux.go:119 +0x1a9 fp=0xc0000a2c28 sp=0xc0000a2b60 pc=0x6ba649
github.com/pion/mediadevices/pkg/io/video.ReaderFunc.Read(0xc00031c1b0, 0x0, 0x0, 0xc00031c090, 0x90)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/io/video/video.go:12 +0x39 fp=0xc0000a2c78 sp=0xc0000a2c28 pc=0x608719
github.com/pion/mediadevices/pkg/io/video.ToI420.func1(0x9bd6aa, 0x91f888, 0xc00031c120, 0x1)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/io/video/convert.go:11 +0x65 fp=0xc0000a2d98 sp=0xc0000a2c78 pc=0x6087f5
github.com/pion/mediadevices/pkg/io/video.ReaderFunc.Read(0xc00030a200, 0x2000, 0xc00031e580, 0xc00031c100, 0x1)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/io/video/video.go:12 +0x39 fp=0xc0000a2de8 sp=0xc0000a2d98 pc=0x608719
github.com/pion/mediadevices/pkg/codec/vpx.(*encoder).Read(0xc00031e5a0, 0xc000408000, 0x2000, 0x2000, 0x0, 0x0, 0x0)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/codec/vpx/vpx.go:124 +0x1fa fp=0xc0000a2f40 sp=0xc0000a2de8 pc=0x9bd6aa
github.com/pion/mediadevices.(*videoTrack).start(0xc0003321e0)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/track.go:123 +0xc9 fp=0xc0000a2fd8 sp=0xc0000a2f40 pc=0x927449
runtime.goexit()
	/usr/lib/golang114/src/runtime/asm_amd64.s:1375 +0x1 fp=0xc0000a2fe0 sp=0xc0000a2fd8 pc=0x49b9e1
created by github.com/pion/mediadevices.newVideoTrack
	/home/atsushi.w/go/src/github.com/pion/mediadevices/track.go:114 +0x345

goroutine 1 [chan receive]:
testing.(*T).Run(0xc000152c60, 0xb85651, 0x8, 0xba55d8, 0x0)
	/usr/lib/golang114/src/testing/testing.go:1045 +0x699
testing.runTests.func1(0xc000152c60)
	/usr/lib/golang114/src/testing/testing.go:1286 +0xa7
testing.tRunner(0xc000152c60, 0xc00012fd50)
	/usr/lib/golang114/src/testing/testing.go:993 +0x1ec
testing.runTests(0xc0001389a0, 0xf4ab50, 0x1, 0x1, 0x0)
	/usr/lib/golang114/src/testing/testing.go:1284 +0x528
testing.(*M).Run(0xc000182000, 0x0)
	/usr/lib/golang114/src/testing/testing.go:1201 +0x300
main.main()
	_testmain.go:44 +0x224

goroutine 35 [chan receive]:
testing.(*T).Run(0xc000152d80, 0xb86856, 0xb, 0xc0000620e0, 0xc00005ab00)
	/usr/lib/golang114/src/testing/testing.go:1045 +0x699
github.com/pion/mediadevices/examples/simple.TestMain(0xc000152d80)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/examples/simple/main_test.go:25 +0x35b
testing.tRunner(0xc000152d80, 0xba55d8)
	/usr/lib/golang114/src/testing/testing.go:993 +0x1ec
created by testing.(*T).Run
	/usr/lib/golang114/src/testing/testing.go:1044 +0x661

goroutine 3 [runnable]:
syscall.Syscall(0xb, 0x7ff4559ec000, 0x96000, 0x0, 0x0, 0x0, 0x0)
	/usr/lib/golang114/src/syscall/asm_linux_amd64.s:18 +0x5
golang.org/x/sys/unix.munmap(0x7ff4559ec000, 0x96000, 0x7ff455a81fff, 0xc0003b26a8)
	/home/atsushi.w/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_linux_amd64.go:1612 +0x59
golang.org/x/sys/unix.(*mmapper).Munmap(0xf4b580, 0x7ff4559ec000, 0x96000, 0x96000, 0x0, 0x0)
	/home/atsushi.w/go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:149 +0x21c
golang.org/x/sys/unix.Munmap(...)
	/home/atsushi.w/go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:1684
github.com/blackjack/webcam.mmapReleaseBuffer(...)
	/home/atsushi.w/go/pkg/mod/github.com/blackjack/[email protected]/v4l2.go:414
github.com/blackjack/webcam.(*Webcam).StopStreaming(0xc0003148d0, 0x6, 0xf0c26b5157419600)
	/home/atsushi.w/go/pkg/mod/github.com/blackjack/[email protected]/webcam.go:255 +0x144
github.com/pion/mediadevices/pkg/driver/camera.(*camera).Close(0xc0001186f0, 0xc00012dbc0, 0xb076a0)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/driver/camera/camera_linux.go:71 +0xc3
github.com/pion/mediadevices/pkg/driver.(*State).Update(0xc0001000e0, 0xb84dc5, 0x6, 0xc00012dcd8, 0x0, 0x0)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/driver/state.go:36 +0x367
github.com/pion/mediadevices/pkg/driver.(*adapterWrapper).Close(0xc0001000a0, 0xc0000a5d30, 0x926d4a)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/pkg/driver/wrapper.go:56 +0xa0
github.com/pion/mediadevices.(*videoTrack).Stop(0xc0003321e0)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/track.go:142 +0x5a
github.com/pion/mediadevices/examples/simple.TestMain.func1(0xc000294000)
	/home/atsushi.w/go/src/github.com/pion/mediadevices/examples/simple/main_test.go:56 +0x394
testing.tRunner(0xc000294000, 0xc0000620e0)
	/usr/lib/golang114/src/testing/testing.go:993 +0x1ec
created by testing.(*T).Run
	/usr/lib/golang114/src/testing/testing.go:1044 +0x661
FAIL	github.com/pion/mediadevices/examples/simple	26.964s
FAIL

from mediadevices.

at-wat avatar at-wat commented on July 23, 2024
  for i := 0; i < fi; i += 4 {
    if slow >= len(cb) {
      panic(fmt.Sprintf("%d >= %d\n", slow, len(cb)))
    }
    if slow >= len(cr) {
      panic(fmt.Sprintf("%d >= %d\n", slow, len(cr)))
    }
    if fast+1 >= len(y) {
      panic(fmt.Sprintf("%d >= %d\n", fast+1, len(y)))
    }
    if i+3 >= len(frame) {
      panic(fmt.Sprintf("%d >= %d\n", i, len(frame)))
    }
    v1 := frame[i]
    y[fast] = v1
    v2 := frame[i+1] // segmentation faule
    cb[slow] = v2
    v3 := frame[i+2]
    y[fast+1] = v3
    v4 := frame[i+3]
    cr[slow] = v4
    fast += 2
    slow++
  }

The index seems not exceeding the size. but the frame is freed unexpectedly?

from mediadevices.

at-wat avatar at-wat commented on July 23, 2024

After trying a while, I get that the failure also accures without stun server setting, but the frequency is much lower.

from mediadevices.

at-wat avatar at-wat commented on July 23, 2024

Segmentation fault seems caused on StopStreaming which releases buffers, it is unrelated to the timeout.

StopStreaming must be called after ensuring that the frame is no longer accessed.

from mediadevices.

at-wat avatar at-wat commented on July 23, 2024

Looks being fixed on release Go1.14.

from mediadevices.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.