Opened 6 years ago

Last modified 4 years ago

#314 open enhancement

OpenAL device does not work on OS X

Reported by: nieder Owned by:
Priority: wish Component: avdevice
Version: git-master Keywords: openal osx
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

configure is not set to find openal on OS X.

The fix for the linker check is easy: add "-Wl,-framework,OpenAL" to the list of flags to check

-enabled openal     && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
+enabled openal     && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32" "-Wl,-framework,OpenAL"; do

I don't know how to fix the header check to look for multiple possibilities, but on OS X the header in the OpenAL framework is found in OpenAL/al.h (not AL/al.h like in linux). If I change the header check in configure and the includes in libavdevice/openal-dec.c, the build and linkage works well.

However, running 'ffmpeg -f openal' as suggested in the manual fails with an malloc error, so this might just not be doable on OS X.

nieder $ /usr/local/ffmpeg-git/bin/ffmpeg -list_devices true -f openal -i dummy out.ogg
ffmpeg version N-31036-g65eae2a, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 27 2011 10:29:19 with gcc 4.0.1 (Apple Inc. build 5493)
  configuration: --prefix=/usr/local/ffmpeg-git --mandir=/usr/local/ffmpeg-git/share/man --disable-static --enable-shared --enable-gpl --enable-version3 --enable-postproc --enable-pthreads --enable-x11grab --enable-bzlib --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-openal --enable-zlib --disable-debug --extra-cflags='-I/sw/lib/libspeex1/include -I/sw/include -I/usr/X11R6/include' --extra-ldflags='-L/sw/lib/libspeex1/lib -L/sw/lib -L/usr/X11R6/lib'
  libavutil    51. 10. 0 / 51. 10. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 0 /  2. 24. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[openal @ 0x200a800] List of OpenAL capture devices on this system:
[openal @ 0x200a800]   Built-in Microphone
dummy: Immediate exit requested

nieder $ /usr/local/ffmpeg-git/bin/ffmpeg -f openal -i 'Built-in Microphone' out.ogg
ffmpeg version N-31036-g65eae2a, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 27 2011 10:29:19 with gcc 4.0.1 (Apple Inc. build 5493)
  configuration: --prefix=/usr/local/ffmpeg-git --mandir=/usr/local/ffmpeg-git/share/man --disable-static --enable-shared --enable-gpl --enable-version3 --enable-postproc --enable-pthreads --enable-x11grab --enable-bzlib --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-openal --enable-zlib --disable-debug --extra-cflags='-I/sw/lib/libspeex1/include -I/sw/include -I/usr/X11R6/include' --extra-ldflags='-L/sw/lib/libspeex1/lib -L/sw/lib -L/usr/X11R6/lib'
  libavutil    51. 10. 0 / 51. 10. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 0 /  2. 24. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
mpeg(49840,0xa025b720) malloc: *** error for object 0x1e2c0e0: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
mpeg(49840,0xa025b720) malloc: *** error for object 0x1e2c0e0: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
[openal @ 0x200a800] Error: ALC Invalid Device
Bus error

Change History (2)

comment:1 Changed 6 years ago by cehoyos

  • Keywords openal osx added

comment:2 Changed 4 years ago by cehoyos

  • Priority changed from normal to wish
  • Reproduced by developer set
  • Status changed from new to open

I can reproduce the crash if I force OpenAL enabled and fix the includes and linker flags.

(lldb) r -f openal -i 'Built-in Microphone'
Process 20723 launched: 'ffmpeg_g' (x86_64)
ffmpeg version N-58952-gf8d8d2e Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 10 2013 14:49:51 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: 
  libavutil      52. 58.100 / 52. 58.100
  libavcodec     55. 45.100 / 55. 45.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 92.100 /  3. 92.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
ffmpeg_g(20723,0x7fff785df180) malloc: *** error for object 0x10131f138: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Process 20723 stopped
* thread #1: tid = 0x983b, 0x00007fff8be15212 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread, stop reason = signal SIGABRT
    frame #0: 0x00007fff8be15212 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill + 10:
-> 0x7fff8be15212:  jae    0x7fff8be15219            ; __pthread_kill + 17
   0x7fff8be15214:  jmpq   0x7fff8be164d4            ; cerror_nocancel
   0x7fff8be15219:  ret    
   0x7fff8be1521a:  nop    
(lldb) bt
* thread #1: tid = 0x983b, 0x00007fff8be15212 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread, stop reason = signal SIGABRT
    frame #0: 0x00007fff8be15212 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff88f09b24 libsystem_c.dylib`pthread_kill + 90
    frame #2: 0x00007fff88f4df61 libsystem_c.dylib`abort + 143
    frame #3: 0x00007fff88f298d5 libsystem_c.dylib`szone_error + 580
    frame #4: 0x00007fff88f2e2c2 libsystem_c.dylib`tiny_malloc_from_free_list + 378
    frame #5: 0x00007fff88f2eb08 libsystem_c.dylib`szone_malloc_should_clear + 971
    frame #6: 0x00007fff88f26978 libsystem_c.dylib`szone_memalign + 89
    frame #7: 0x00007fff88f2171a libsystem_c.dylib`malloc_zone_memalign + 114
    frame #8: 0x00007fff88f21f4e libsystem_c.dylib`posix_memalign + 54
    frame #9: 0x00000001006d4ecd ffmpeg_g`av_mallocz [inlined] av_malloc(size=104) + 49 at mem.c:94
    frame #10: 0x00000001006d4e9c ffmpeg_g`av_mallocz(size=104) + 12 at mem.c:244
    frame #11: 0x0000000100139951 ffmpeg_g`avformat_find_stream_info [inlined] add_to_pktbuf(pkt=0x000000010131ee00) + 5 at utils.c:463
    frame #12: 0x000000010013994c ffmpeg_g`avformat_find_stream_info(ic=0x0000000101818a00, options=0x0000000101315440) + 1244 at utils.c:2959
    frame #13: 0x0000000100006c25 ffmpeg_g`open_input_file(o=0x00007fff5fbff6d0, filename=<unavailable>) + 1397 at ffmpeg_opt.c:861
    frame #14: 0x0000000100006510 ffmpeg_g`open_files(l=0x000000010130e678, inout=0x0000000100851a0c, open_file=0x00000001000066b0) + 256 at ffmpeg_opt.c:2583
    frame #15: 0x0000000100006352 ffmpeg_g`ffmpeg_parse_options(argc=<unavailable>, argv=<unavailable>) + 178 at ffmpeg_opt.c:2620
    frame #16: 0x00000001000105e8 ffmpeg_g`main(argc=<unavailable>, argv=<unavailable>) + 184 at ffmpeg.c:3522
    frame #17: 0x00007fff92ec27e1 libdyld.dylib`start + 1
Note: See TracTickets for help on using tickets.