mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
force set camera enabled when accepting call (camera seems to be enabled by default on macos)
This commit is contained in:
parent
7e0a33766b
commit
0b1c081aaa
4 changed files with 24 additions and 4 deletions
|
|
@ -112,7 +112,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
|
||||||
mLocalVideoEnabled =
|
mLocalVideoEnabled =
|
||||||
videoDirection == linphone::MediaDirection::SendOnly || videoDirection == linphone::MediaDirection::SendRecv;
|
videoDirection == linphone::MediaDirection::SendOnly || videoDirection == linphone::MediaDirection::SendRecv;
|
||||||
mCameraEnabled = mLocalVideoEnabled && callParams->cameraEnabled();
|
mCameraEnabled = mLocalVideoEnabled && callParams->cameraEnabled();
|
||||||
qDebug() << "create call with camera enabled" << mLocalVideoEnabled << callParams->cameraEnabled();
|
lDebug() << log().arg("create call with camera enabled") << mLocalVideoEnabled << callParams->cameraEnabled();
|
||||||
auto remoteParams = call->getRemoteParams();
|
auto remoteParams = call->getRemoteParams();
|
||||||
videoDirection = remoteParams ? remoteParams->getVideoDirection() : linphone::MediaDirection::Inactive;
|
videoDirection = remoteParams ? remoteParams->getVideoDirection() : linphone::MediaDirection::Inactive;
|
||||||
mRemoteVideoEnabled =
|
mRemoteVideoEnabled =
|
||||||
|
|
@ -248,7 +248,10 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
|
||||||
mCallModelConnection->invokeToCore([this, enabled]() { setLocalVideoEnabled(enabled); });
|
mCallModelConnection->invokeToCore([this, enabled]() { setLocalVideoEnabled(enabled); });
|
||||||
});
|
});
|
||||||
mCallModelConnection->makeConnectToModel(&CallModel::cameraEnabledChanged, [this](bool enabled) {
|
mCallModelConnection->makeConnectToModel(&CallModel::cameraEnabledChanged, [this](bool enabled) {
|
||||||
mCallModelConnection->invokeToCore([this, enabled]() { setCameraEnabled(enabled); });
|
mCallModelConnection->invokeToCore([this, enabled]() {
|
||||||
|
lDebug() << log().arg("Camera enabled changed") << enabled;
|
||||||
|
setCameraEnabled(enabled);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
mCallModelConnection->makeConnectToModel(&CallModel::durationChanged, [this](int duration) {
|
mCallModelConnection->makeConnectToModel(&CallModel::durationChanged, [this](int duration) {
|
||||||
mCallModelConnection->invokeToCore([this, duration]() { setDuration(duration); });
|
mCallModelConnection->invokeToCore([this, duration]() { setDuration(duration); });
|
||||||
|
|
@ -264,10 +267,18 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
|
||||||
mCallModelConnection->makeConnectToModel(&CallModel::stateChanged, [this](std::shared_ptr<linphone::Call> call,
|
mCallModelConnection->makeConnectToModel(&CallModel::stateChanged, [this](std::shared_ptr<linphone::Call> call,
|
||||||
linphone::Call::State state,
|
linphone::Call::State state,
|
||||||
const std::string &message) {
|
const std::string &message) {
|
||||||
|
if (state == linphone::Call::State::Connected) {
|
||||||
|
lDebug() << log().arg("call connected, video direction") << (int)call->getParams()->getVideoDirection()
|
||||||
|
<< call->getParams()->cameraEnabled();
|
||||||
|
}
|
||||||
bool isConf = call && call->getConference() != nullptr;
|
bool isConf = call && call->getConference() != nullptr;
|
||||||
auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : "";
|
auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : "";
|
||||||
mCallModelConnection->invokeToCore([this, state, subject, isConf]() {
|
bool cameraEnabled = call->getParams()->cameraEnabled();
|
||||||
|
mCallModelConnection->invokeToCore([this, state, subject, isConf, cameraEnabled]() {
|
||||||
lDebug() << log().arg("::onStateChanged") << LinphoneEnums::fromLinphone(state);
|
lDebug() << log().arg("::onStateChanged") << LinphoneEnums::fromLinphone(state);
|
||||||
|
if (state == linphone::Call::State::Connected) {
|
||||||
|
setCameraEnabled(cameraEnabled);
|
||||||
|
}
|
||||||
setRecordable(state == linphone::Call::State::StreamsRunning);
|
setRecordable(state == linphone::Call::State::StreamsRunning);
|
||||||
setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote);
|
setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote);
|
||||||
if (mConference) mConference->setSubject(subject);
|
if (mConference) mConference->setSubject(subject);
|
||||||
|
|
@ -573,7 +584,7 @@ bool CallCore::getCameraEnabled() const {
|
||||||
void CallCore::setCameraEnabled(bool enabled) {
|
void CallCore::setCameraEnabled(bool enabled) {
|
||||||
if (mCameraEnabled != enabled) {
|
if (mCameraEnabled != enabled) {
|
||||||
mCameraEnabled = enabled;
|
mCameraEnabled = enabled;
|
||||||
lDebug() << "CameraEnabled: " << mCameraEnabled;
|
lDebug() << "Set cameraEnabled: " << mCameraEnabled;
|
||||||
emit cameraEnabledChanged();
|
emit cameraEnabledChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,11 @@ void CallModel::accept(bool withVideo) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lDebug() << log().arg("Accept with video") << withVideo;
|
||||||
activateLocalVideo(params, withVideo);
|
activateLocalVideo(params, withVideo);
|
||||||
|
params->enableCamera(withVideo);
|
||||||
|
lDebug() << log().arg("Accept call with video directon") << (int)params->getVideoDirection()
|
||||||
|
<< "Camera enabled =" << params->cameraEnabled();
|
||||||
mMonitor->acceptWithParams(params);
|
mMonitor->acceptWithParams(params);
|
||||||
emit localVideoEnabledChanged(withVideo);
|
emit localVideoEnabledChanged(withVideo);
|
||||||
emit cameraEnabledChanged(withVideo && params->cameraEnabled());
|
emit cameraEnabledChanged(withVideo && params->cameraEnabled());
|
||||||
|
|
@ -148,13 +152,16 @@ void CallModel::activateLocalVideo(std::shared_ptr<linphone::CallParams> ¶ms
|
||||||
.arg((int)params->getVideoDirection());
|
.arg((int)params->getVideoDirection());
|
||||||
params->enableVideo(SettingsModel::getInstance()->getVideoEnabled());
|
params->enableVideo(SettingsModel::getInstance()->getVideoEnabled());
|
||||||
auto videoDirection = params->getVideoDirection();
|
auto videoDirection = params->getVideoDirection();
|
||||||
|
lDebug() << "Activate local video" << enable << "screen sharing enabled" << params->screenSharingEnabled();
|
||||||
params->setVideoDirection(enable || params->screenSharingEnabled() ? linphone::MediaDirection::SendRecv
|
params->setVideoDirection(enable || params->screenSharingEnabled() ? linphone::MediaDirection::SendRecv
|
||||||
: linphone::MediaDirection::RecvOnly);
|
: linphone::MediaDirection::RecvOnly);
|
||||||
|
lDebug() << "video direction" << (int)params->getVideoDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallModel::setLocalVideoEnabled(bool enabled) {
|
void CallModel::setLocalVideoEnabled(bool enabled) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
auto params = CoreModel::getInstance()->getCore()->createCallParams(mMonitor);
|
auto params = CoreModel::getInstance()->getCore()->createCallParams(mMonitor);
|
||||||
|
lDebug() << log().arg(Q_FUNC_INFO) << "enabled =" << enabled;
|
||||||
activateLocalVideo(params, enabled);
|
activateLocalVideo(params, enabled);
|
||||||
mMonitor->update(params);
|
mMonitor->update(params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,7 @@ Control.Control {
|
||||||
? qsTr("chat_message_user_replied_to").arg(mainItem.chatMessage.core.repliedToName)
|
? qsTr("chat_message_user_replied_to").arg(mainItem.chatMessage.core.repliedToName)
|
||||||
//: You replied
|
//: You replied
|
||||||
: qsTr("chat_message_user_replied")
|
: qsTr("chat_message_user_replied")
|
||||||
|
textFormat: Text.RichText
|
||||||
color: DefaultStyle.main2_600
|
color: DefaultStyle.main2_600
|
||||||
font {
|
font {
|
||||||
pixelSize: Typography.p4.pixelSize
|
pixelSize: Typography.p4.pixelSize
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ Item {
|
||||||
property bool videoEnabled: (previewEnabled && call && call.core.cameraEnabled)
|
property bool videoEnabled: (previewEnabled && call && call.core.cameraEnabled)
|
||||||
|| (!previewEnabled && call && call.core.remoteVideoEnabled)
|
|| (!previewEnabled && call && call.core.remoteVideoEnabled)
|
||||||
|| (participantDevice && participantDevice.core.videoEnabled)
|
|| (participantDevice && participantDevice.core.videoEnabled)
|
||||||
|
onVideoEnabledChanged: console.log("Sticker : video enabled changed", videoEnabled, "preview enabled =", previewEnabled, "call core camera enabled =", call.core.cameraEnabled)
|
||||||
property string qmlName
|
property string qmlName
|
||||||
property bool displayAll : !!mainItem.call
|
property bool displayAll : !!mainItem.call
|
||||||
property bool mutedStatus: participantDevice
|
property bool mutedStatus: participantDevice
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue