V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Yoock
V2EX  ›  问与答

有没有熟悉 ffmpeg 的同学?我这样用 cgo 调用,为什么每次都会 fatal???

  •  1
     
  •   Yoock · 2019-06-17 23:41:51 +08:00 · 2196 次点击
    这是一个创建于 1986 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码如下

    https://gist.github.com/kaiiak/4e5f058f4289153a525a54fbc43e756a

    错误信息如下

    === RUN   TestMp3TransformPcm
    [mp3 @ 0xd000000] Estimating duration from bitrate, this may be inaccurate
    find audio index 0
    fatal error: unexpected signal during runtime execution
    [signal SIGSEGV: segmentation violation code=0x1 addr=0xa8 pc=0x5043cb9]
    
    runtime stack:
    runtime.throw(0x420e33b, 0x2a)
    	/usr/local/opt/go/libexec/src/runtime/panic.go:617 +0x72
    runtime.sigpanic()
    	/usr/local/opt/go/libexec/src/runtime/signal_unix.go:374 +0x4a9
    
    goroutine 19 [syscall]:
    runtime.cgocall(0x41a2b30, 0xc000058d30, 0x4cee7a3)
    	/usr/local/opt/go/libexec/src/runtime/cgocall.go:128 +0x7a fp=0xc000058d00 sp=0xc000058cc8 pc=0x40059fa
    github.com/giorgisio/goav/avcodec._Cfunc_avcodec_decode_audio4(0x9806c00, 0xa127040, 0xc0000a0008, 0xa126600, 0x0)
    	_cgo_gotypes.go:2173 +0x6b fp=0xc000058d30 sp=0xc000058d00 pc=0x415b31b
    github.com/giorgisio/goav/avcodec.(*Context).AvcodecDecodeAudio4.func1(0x9806c00, 0xa127040, 0xc0000a0008, 0xa126600, 0x0)
    	/Users/go/src/github.com/giorgisio/goav/avcodec/context.go:100 +0xdc fp=0xc000058d70 sp=0xc000058d30 pc=0x415b89c
    github.com/giorgisio/goav/avcodec.(*Context).AvcodecDecodeAudio4(0x9806c00, 0xa127040, 0xc0000a0008, 0xa126600, 0x2)
    	/Users/go/src/github.com/giorgisio/goav/avcodec/context.go:100 +0x57 fp=0xc000058db0 sp=0xc000058d70 pc=0x415b5b7
    ffmpeg.Mp3TransformPcm(0x4206e3c, 0x5, 0x4233480, 0xc0000ae008, 0x0, 0x0)
    	ffmpeg/mp3_to_pcm.go:53 +0x82d fp=0xc000058ef0 sp=0xc000058db0 pc=0x4169d3d
    ffmpeg.TestMp3TransformPcm(0xc0000e6100)
    	ffmpeg/mp3_to_pcm_test.go:14 +0x113 fp=0xc000058f70 sp=0xc000058ef0 pc=0x416a533
    testing.tRunner(0xc0000e6100, 0x420fc50)
    	/usr/local/opt/go/libexec/src/testing/testing.go:865 +0x164 fp=0xc000058fd0 sp=0xc000058f70 pc=0x40f2654
    runtime.goexit()
    	/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000058fd8 sp=0xc000058fd0 pc=0x405c1f1
    created by testing.(*T).Run
    	/usr/local/opt/go/libexec/src/testing/testing.go:916 +0x65b
    
    goroutine 1 [chan receive]:
    testing.(*T).Run(0xc0000e6000, 0x4209586, 0x13, 0x420fc50, 0x0)
    	/usr/local/opt/go/libexec/src/testing/testing.go:917 +0x693
    testing.runTests.func1(0xc0000e6000)
    	/usr/local/opt/go/libexec/src/testing/testing.go:1157 +0xa9
    testing.tRunner(0xc0000e6000, 0xc0000cdd48)
    	/usr/local/opt/go/libexec/src/testing/testing.go:865 +0x164
    testing.runTests(0xc00000e060, 0x4333190, 0x1, 0x1, 0x0)
    	/usr/local/opt/go/libexec/src/testing/testing.go:1155 +0x524
    testing.(*M).Run(0xc0000da000, 0x0)
    	/usr/local/opt/go/libexec/src/testing/testing.go:1072 +0x2ec
    main.main()
    	_testmain.go:90 +0x335
    FAIL	ffmpeg	0.102s
    Error: Tests failed.
    
    第 1 条附言  ·  2019-06-18 00:27:54 +08:00
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2650 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 02:47 · PVG 10:47 · LAX 18:47 · JFK 21:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.