Opened 8 years ago

Last modified 8 months 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 (4)

comment:1 Changed 8 years ago by cehoyos

  • Keywords openal osx added

comment:2 Changed 6 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

comment:3 Changed 8 months ago by richardpl

Is this still true?

comment:4 Changed 8 months ago by nieder

I no longer get the crash with git HEAD:

nieder $ /usr/local/ffmpeg-clang/bin/ffmpeg -f openal -i 'Built-in Microphone' out.ogg
ffmpeg version N-92738-g3a36b0c4b8 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/ffmpeg-clang --enable-autodetect --enable-gpl --enable-version3 --disable-static --enable-shared --enable-pthreads --disable-indev=jack --enable-bzlib --enable-chromaprint --enable-frei0r --enable-gcrypt --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcelt --enable-libcdio --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libkvazaar --enable-liblensfun --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librtmp --enable-librubberband --disable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-opencl --enable-opengl --enable-sdl2 --enable-videotoolbox --enable-zlib --cc=clang --extra-ldflags='-Wl,-dead_strip_dylibs -L/sw/lib' --extra-cflags=-I/sw/include --enable-openal
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 42.104 / 58. 42.104
  libavformat    58. 24.101 / 58. 24.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
2018-12-19 03:25:56.476 ffmpeg[49601:18236883] 03:25:56.476 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, openal, from 'Built-in Microphone':
  Duration: N/A, start: 1545211556.601565, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
Output #0, ogg, to 'out.ogg':
  Metadata:
    encoder         : Lavf58.24.101
    Stream #0:0: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc58.42.104 libvorbis
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time
    Last message repeated 10 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.887x    
    Last message repeated 13 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.953x    
    Last message repeated 12 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.955x    
    Last message repeated 10 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.96x    
    Last message repeated 13 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.973x    
    Last message repeated 11 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.977x    
    Last message repeated 11 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.981x    
    Last message repeated 14 times
[libvorbis @ 0x7fa1bd81d400] Queue input is backward in time=0.983x    
    Last message repeated 5 times
[ogg @ 0x7fa1bd81c200] Non-monotonous DTS in output stream 0:0; previous: 184694, current: 184328; changing to 184694. This may result in incorrect timestamps in the output file.
[ogg @ 0x7fa1bd81c200] Non-monotonous DTS in output stream 0:0; previous: 184694, current: 184456; changing to 184694. This may result in incorrect timestamps in the output file.
...

and the output file is successfully recorded.

However, I still had to modify header names and linker flags which are non-macOS centric.

Note: See TracTickets for help on using tickets.