运行ffmpeg + sdl程序时出现分段错误

时间:2015-06-22 05:08:25

标签: c ffmpeg sdl

我开始使用Dranger's tutorials来构建使用FFMPEG和SDL的视频播放器。代码tutorial4编译得很好,但是当我运行它时,我得到一个分段错误错误。 here's the code for tutorial4.

我正在使用gcc

Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix 

在Mac 10.10.3上。

此处的GDB Backtrace:

 Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x1813 of process 84136]
0x00007fff955d4432 in stack_not_16_byte_aligned_error ()
from /usr/lib/system/libdyld.dylib
(gdb) backtrace 
#0  0x00007fff955d4432 in stack_not_16_byte_aligned_error ()
from /usr/lib/system/libdyld.dylib
#1  0x000000010a2f1ee0 in ?? ()
#2  0x0000000101341008 in ?? () from /usr/local/lib/libSDL-1.2.0.dylib
#3  0x00000000000005d0 in ?? ()
#4  0x00000001013362e9 in RunThread () from /usr/local/lib/libSDL-1.2.0.dylib
#5  0x00000001013362e2 in RunThread () from /usr/local/lib/libSDL-1.2.0.dylib
#6  0x00007fff8d1d4268 in ?? () from /usr/lib/system/libsystem_pthread.dylib
#7  0x0000000000006f23 in ?? ()
#8  0x000000010a2f2000 in ?? ()
#9  0x000000010a2f1f50 in ?? ()  
#10 0x00007fff8d1d41e5 in ?? () from /usr/lib/system/libsystem_pthread.dylib
#11 0x0000000000000000 in ?? ()
(gdb) 

另一个SIGSEGV的Backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x15eb of process 11453]
0x00000001012c9475 in av_log_format_line ()
from /usr/local/lib/libavutil.54.dylib
(gdb) bt
#0  0x00000001012c9475 in av_log_format_line ()
from /usr/local/lib/libavutil.54.dylib
#1  0x00000001012f7338 in av_pix_fmt_descriptors ()
from /usr/local/lib/libavutil.54.dylib
#2  0x00000018012f7358 in ?? ()
#3  0x000000010a2f3010 in ?? ()
#4  0x000000010a2f2c10 in ?? ()
#5  0x000000010011d65a in ?? () from  /usr/local/lib/libavformat.56.dylib
#6  0x000000010a2f3900 in ?? ()
#7  0x0000000000000018 in ?? ()
#8  0x0000000000000018 in ?? ()
#9  0x000000010011d65a in ?? () from /usr/local/lib/libavformat.56.dylib
#10 0x000000010a2f3900 in ?? ()
#11 0x910016d093cdc267 in ?? ()
#12 0x000000010a2f3eb0 in ?? ()
#13 0x00000001012c96e8 in av_log_default_callback ()
from /usr/local/lib/libavutil.54.dylib
#14 0x0000000000000000 in ?? ()
(gdb) 

在main方法中调用SDL_WaitEvent是我的调试中出现这些错误的地方。

for(;;) {
SDL_WaitEvent(&event);
switch(event.type) {
case FF_QUIT_EVENT:
case SDL_QUIT:
  is->quit = 1;
  SDL_Quit();
  return 0;
  break;
case FF_REFRESH_EVENT:
  video_refresh_timer(event.user.data1);
  break;
default:
  break;
 }
}

这与pthread库或sdl有关我该怎么解决它?

0 个答案:

没有答案