aperture-node
aperture-node copied to clipboard
Audio devices error logs
From https://github.com/wulkano/kap/issues/825#issuecomment-619150609
Sometimes getting the audio devices from the swift script prints a lot of other stuff in stderr, and so the parsing fails, in which case we return the whole stderr.
Example return:
2020-04-24 13:01:02.071 aperture[9823:124325] alloc
2020-04-24 13:01:02.072 aperture[9823:124325] query 2
2020-04-24 13:01:02.072 aperture[9823:124325] release 2
2020-04-24 13:01:02.072 aperture[9823:124325] ** MyPlugInitializeWithObjectID
2020-04-24 13:01:02.072 aperture[9823:124325] init
2020-04-24 13:01:02.072 aperture[9823:124325] MyPlugObjectSetPropertyData
2020-04-24 13:01:02.072 aperture[9823:124325] MyPlugObjectSetPropertyData
2020-04-24 13:01:02.072 aperture[9823:124325] MyPlugObjectSetPropertyData
2020-04-24 13:01:02.284 aperture[9823:124325] <CMVideoFormatDescription 0x7fe14421e400 [0x7fff8d8d28c0]> {
mediaType:'vide'
mediaSubType:'BGRA'
mediaSpecific: {
codecType: 'BGRA' dimensions: 320 x 240
}
extensions: {{
CVBytesPerRow = 1280;
CVFieldCount = 1;
FormatName = "Component Video - CCIR-601 RGB";
"com.apple.cmio.format_extension.video.only_has_i_frames" = 1;
}}
}
2020-04-24 13:01:02.284 aperture[9823:124325] alloc
2020-04-24 13:01:02.284 aperture[9823:124325] query 2
2020-04-24 13:01:02.284 aperture[9823:124325] release 2
2020-04-24 13:01:02.284 aperture[9823:124325] ** MyPlugInitializeWithObjectID
2020-04-24 13:01:02.284 aperture[9823:124325] init
2020-04-24 13:01:02.284 aperture[9823:124325] MyPlugObjectSetPropertyData
2020-04-24 13:01:02.284 aperture[9823:124325] MyPlugObjectSetPropertyData
2020-04-24 13:01:02.284 aperture[9823:124325] MyPlugObjectSetPropertyData
2020-04-24 13:01:02.284 aperture[9823:124325] <CMVideoFormatDescription 0x7fe144220030 [0x7fff8d8d28c0]> {
mediaType:'vide'
mediaSubType:'2vuy'
mediaSpecific: {
codecType: '2vuy' dimensions: 320 x 240
}
extensions: {{
CVFieldCount = 1;
CVImageBufferColorPrimaries = "SMPTE_C";
CVImageBufferTransferFunction = "ITU_R_709_2";
CVImageBufferYCbCrMatrix = "ITU_R_601_4";
FormatName = "Component Video - CCIR-601 uyvy";
"com.apple.cmio.format_extension.video.only_has_i_frames" = 1;
}}
}
2020-04-24 13:01:02.293 aperture[9823:124325] MyPlugObjectHasProperty
2020-04-24 13:01:02.293 aperture[9823:124325] enog
2020-04-24 13:01:02.293 aperture[9823:124325] bolg
2020-04-24 13:01:02.293 aperture[9823:124325] 0
2020-04-24 13:01:02.293 aperture[9823:124325] MyPlugObjectSetPropertyData
... // List of audio devices below
[{"id":"Someabracadabramagic","name":"ManyCam Virtual Microphone"},{"id":"SoundflowerEngine:1","name":"Soundflower (64ch)"},{"id":"AppleUSBAudioEngine:BLUE MICROPHONE:Blue Snowball:201305:1","name":"Blue Snowball"},{"id":"AppleHDAEngineInput:1B,0,1,0:1","name":"Built-in Microphone"},{"id":"SoundflowerEngine:0","name":"Soundflower (2ch)"}]
2020-04-24 13:01:02.301 aperture[9823:124325] MyPlugTeardown
2020-04-24 13:01:02.301 aperture[9823:124325] MyPlugTeardown
Not sure if that's an issue with Aperture itself, or with this package
It also looks like the method we use to get the devices is deprecated, even though I don't think that has anything to do with the logs: https://developer.apple.com/documentation/avfoundation/avcapturedevice/1390520-devices
It also looks like the method we use to get the devices is deprecated, even though I don't think that has anything to do with the logs: developer.apple.com/documentation/avfoundation/avcapturedevice/1390520-devices
Can you open an issue on Aperture about that? We need to conditionally switch to the new API.
This is a real pickle. We actually write to stderr because Apple logs unrelated things to stdout, and now they also do so on stdout...
https://github.com/wulkano/aperture-node/blob/e09011c4e3c2dbd51c45a4c466809828de7c03d9/Sources/ApertureCLI/main.swift#L71-L72
Maybe we could use something other than stdout/stderr. Our own stream maybe: https://stackoverflow.com/questions/24659200/are-the-extra-stdio-streams-in-node-js-child-process-spawn-blocking ?
But if we do that we'll have to rebuild Aperture and have the swift runtime libraries issue, which I guess we'll run into eventually.
I'm thinking for a temporary solution, we could try using regex to extract the devices from the other logs? I can try a small PR to see if that'll work. So all changes will be node related and we won't have to rebuild
I prefer fixing it properly here and just do the workaround in Kap for now where we fall back to your macOS-audio-devices package.