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

setup the desired sampleRate #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wkpark
Copy link

@wkpark wkpark commented Jul 26, 2021

try to set the desired sampling rate.

Description

this fix try to set the desired sampling rate by modifying nSamplesPerSec

Motivation and Context

I'm not sure but when using a video capture card (MJPEG only ) with a USB audio support (like as ATEM mini)
with Custom Audio setting. OBS does not set/report the correct sampling rate for the selected audio device as follows.

20:13:11.138: [DShow Device: 'ATEMMini'] settings updated:
20:13:11.138: video device: Blackmagic Design
...
20:13:11.138: resolution: 1920x1080
20:13:11.138: flip: 0
20:13:11.138: fps: 60.00 (interval: 166667)
20:13:11.138: format: MJPEG
20:13:11.154: using video device audio: no
20:13:11.154: audio device: Mic (Blackmagic Design)
20:13:11.154: separate audio filter
20:13:11.154: sample rate: 44100 // <-- wrong
20:13:11.154: channels: 2
20:13:11.154: audio type: Capture

and the result of this situation (I guess)

  • frequent audio out of sync while broadcasting
  • need to deactivate/activate again and again to make it work properly.

How Has This Been Tested?

  • OBS sampling rate profile: 48 kHz
  • Video/audio capture cards like the Blackmagic Atem mini (Video - MJPEG, Audio - USB audio)
  • Select custom audio device to its USB audio device
  • broadcasting with these settings results in audio quality problems.

Types of changes

This quick hack try to set the desired sampling rate by modifying nSamplesPerSec

See also

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@WizardCM
Copy link
Member

What happens if the device doesn't support the requested sample rate?

@wkpark
Copy link
Author

wkpark commented Jul 27, 2021

What happens if the device doesn't support the requested sample rate?

as you know,
for this case, SetFormat() will be failed and we can't use the win-dshow plugin
(anyway, obs have another audio driver option.)

f3381a7#diff-55b8bf12e74f93879b4bc14277476b5aa7dcee1f47320a76f812a3754f72c85eL472-L480

(line L472-L480)

...
	if (!!pinConfig) {
		hr = pinConfig->SetFormat(audioMediaType);
		if (FAILED(hr) && hr != E_NOTIMPL) {
			Error(L"Could not set audio format");
			return false;
		}
	}
	

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

Successfully merging this pull request may close these issues.

2 participants