Skip to content

Conversation

@juteman
Copy link

@juteman juteman commented Dec 13, 2021

Change two function parameter name to deviceIdkey.

DesktopCaptureSource DesktopCaptureSourceForKey(
	const std::string &uniqueKey);
bool ShouldBeDesktopCapture(const std::string &uniqueKey);

These function parameters has named "uniqueKey".

But in context of VideoCapturerInterfaceImpl, we get

VideoCapturerInterfaceImpl::VideoCapturerInterfaceImpl(
	rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source,
	std::string deviceId,
	std::function<void(VideoState)> stateUpdated,
	std::shared_ptr<PlatformContext> platformContext,
	std::pair<int, int> &outResolution)
: _source(source)
, _sink(GetSink(source))
, _stateUpdated(stateUpdated) {

	if (const auto source = DesktopCaptureSourceForKey(deviceId)) {
		const auto data = DesktopCaptureSourceData{
			/*.aspectSize = */{ 1280, 720 },
			/*.fps = */24.,
			/*.captureMouse = */(deviceId != "desktop_capturer_pipewire"),
		};
		_desktopCapturer = std::make_unique<DesktopCaptureSourceHelper>(
			source,
			data);
		_desktopCapturer->setOutput(_sink);
		_desktopCapturer->start();
		outResolution = { 1280, 960 };
	} else if (!ShouldBeDesktopCapture(deviceId))
	{
		_cameraCapturer = std::make_unique<VideoCameraCapturer>(_sink);
		_cameraCapturer->setDeviceId(deviceId);
		_cameraCapturer->setState(VideoState::Active);
		outResolution = _cameraCapturer->resolution();
	}
}

We pass "device id" to DesktopCaptureSourceForKey(). So this naming is very confusing.

change two function parameter name to deviceIdkey
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

Successfully merging this pull request may close these issues.

1 participant