Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio devices error logs #10

Open
karaggeorge opened this issue Apr 24, 2020 · 4 comments
Open

Audio devices error logs #10

karaggeorge opened this issue Apr 24, 2020 · 4 comments

Comments

@karaggeorge
Copy link
Member

karaggeorge commented Apr 24, 2020

From wulkano/Kap#825 (comment)

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

@sindresorhus
Copy link
Contributor

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.

@sindresorhus
Copy link
Contributor

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...

// Uses stderr because of unrelated stuff being outputted on stdout
print(try toJson(Devices.audio()), to: .standardError)

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 ?

@karaggeorge
Copy link
Member Author

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

@sindresorhus
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants