Opened 5 years ago

Closed 6 months ago

#43 closed enhancement (fixed)

JACK input device doesn't link on OS X

Reported by: nieder Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: jack osx roundup
Cc: michael Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

This is copied from the old roundup #976
https://roundup.libav.org/issue976

On OS X, using --enable-indev=jack, the build fails with

CC	libavdevice/jack_audio.o
/src/ffmpeg/libavdevice/jack_audio.c: In function 'audio_read_packet':
/src/ffmpeg/libavdevice/jack_audio.c:277: warning: implicit declaration of function 'sem_timedwait'
AR	libavdevice/libavdevice.a
LD	libavdevice/libavdevice.52.dylib
Undefined symbols:
  "_sem_timedwait", referenced from:
      _audio_read_packet in jack_audio.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libavdevice/libavdevice.52.dylib] Error 1

sem_* is semaphore_* on OS X.

Attachments (2)

ffmpeg-jack-osx.patch (3.5 KB) - added by nieder 5 years ago.
provides semaphore_* when HAVE_MACH_SEMAPHORE_H is set
jack-indev-osx.patch (2.8 KB) - added by ethe 6 months ago.
updated patch to use libdispatch when available

Download all attachments as: .zip

Change History (14)

Changed 5 years ago by nieder

provides semaphore_* when HAVE_MACH_SEMAPHORE_H is set

comment:1 Changed 5 years ago by cbsrobot

this patch fixes the issue on osx 10.6.6

comment:2 Changed 5 years ago by michael

  • Resolution set to fixed
  • Status changed from new to closed

Fixed by disabling jack when sem_timedwait() is unavailable.
About the patch, i think thread synchronization functions should be used that are available on a wider range of platforms, not tons of #ifdefs to make it work on osx & linux and then still fail on openbsd which the patch would sadly.

comment:3 Changed 5 years ago by michael

  • Component changed from undetermined to avformat
  • Priority changed from normal to wish
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Type changed from defect to enhancement
  • Version changed from git to git-master

Rethinking this should be a enhancement request of course, as our jack code should use wider available therad sync functions.

comment:4 Changed 5 years ago by cehoyos

  • Keywords jack osx added

comment:5 Changed 4 years ago by cehoyos

  • Keywords roundup added

comment:6 Changed 3 years ago by cehoyos

  • Reproduced by developer set
  • Status changed from reopened to open

The patch can still be used but the resulting executable does not work here:

$ ffmpeg -f jack -i ffmpeg -y out.wav
ffmpeg version N-58952-gf8d8d2e Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 10 2013 15:22:26 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
[jack @ 0x7fa5db820200] JACK client registered and activated (rate=44100Hz, buffer_size=512 frames)
[jack @ 0x7fa5db820200] Input error: timed out when waiting for JACK process callback output
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, jack, from 'ffmpeg':
  Duration: N/A, bitrate: 2822 kb/s
    Stream #0:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_f32le -> pcm_s16le)
Press [q] to stop, [?] for help
[jack @ 0x7fa5db820200] Input error: timed out when waiting for JACK process callback output
ffmpeg: Input/output error
size=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

comment:7 Changed 13 months ago by michael

Does this still affect modern osx ?

comment:8 Changed 13 months ago by michael

  • Cc michael added

comment:9 Changed 13 months ago by nieder

I don't know. I haven't touched any of this in 4 years, and jack on OS X has changed dramatically since then (major version bump) and I know nothing about it. Removing the sem_timedwait() check in configure still causes the Ffmpeg build failure on 10.9+ffmpeg/HEAD, but I no longer have the setup to see if the not very good patch I posted even works on a current system.

comment:10 Changed 8 months ago by ethe

Compiling FFmpeg with ./configure --enable-indev=jack builds however it seems that it's not actually being built into FFmpeg.

$ ./ffmpeg_g -formats |grep 'jack'
ffmpeg version N-77197-gdf2ce13 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-indev=jack
  libavutil      55. 10.100 / 55. 10.100
  libavcodec     57. 17.100 / 57. 17.100
  libavformat    57. 19.100 / 57. 19.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 20.100 /  6. 20.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
$ ./ffmpeg_g -f jack -i ffmpeg -y out.wav
ffmpeg version N-77197-gdf2ce13 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-indev=jack
  libavutil      55. 10.100 / 55. 10.100
  libavcodec     57. 17.100 / 57. 17.100
  libavformat    57. 19.100 / 57. 19.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 20.100 /  6. 20.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
Unknown input format: 'jack'

Changed 6 months ago by ethe

updated patch to use libdispatch when available

comment:11 Changed 6 months ago by ethe

$ ./ffmpeg_g -f jack -i ffmpeg -y out.wav
ffmpeg version N-78597-g9dd4dcd Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-indev=jack
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.101 / 57. 25.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 34.100 /  6. 34.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2015 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Default input and output devices are not the same !!
Cannot open default device in duplex mode, so aggregate default input and default output
CreateAggregateDeviceAux : devices do not share the same clock!! clock drift compensation would be needed...
Separated input = 'Built-in Microphone'
Separated output = 'Built-in Output'
2016-02-18 21:05:02.852 jackd[86281:278269] 21:05:02.850 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.
Input channel = 0 ==> JACK input port = 0
Input channel = 1 ==> JACK input port = 1
JACK output port = 0 ==> output channel = 0
JACK output port = 1 ==> output channel = 1
DeviceNotificationCallback kAudioDeviceProcessorOverload
CoreAudio driver is running...
[jack @ 0x7faeb1008000] JACK client registered and activated (rate=44100Hz, buffer_size=256 frames)
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, jack, from 'ffmpeg':
  Duration: N/A, start: 1455829503.154074, bitrate: 2822 kb/s
    Stream #0:0: Audio: pcm_f32le, 44100 Hz, 2 channels, flt, 2822 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf57.25.101
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc57.24.103 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=    3762kB time=00:00:21.83 bitrate=1411.2kbits/s speed=   1x
video:0kB audio:3762kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002025%
JackTemporaryException : now quits...
Jack main caught signal 2


$ mpv out.wav
Playing: out.wav
 (+) Audio --aid=1 (pcm_s16le)
AO: [coreaudio] 44100Hz stereo 2ch s16
A: 00:00:15 / 00:00:21 (69%)
Exiting... (Quit)

Is the output with the updated patch upon the latest git on OSX 10.11.3

comment:12 Changed 6 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Fixed by Josh de Kock in 67f8a0be54554715a93a4e288da3247c9a5d4e1c

Note: See TracTickets for help on using tickets.