mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
calls: fix stop file/screen sharing fallback to camera
If we start a file/screen sharing from a call with closed camera, once we stop the sharing, the camera should not open. Change-Id: Ifb6986f8c5452d721f72fb15072cd5ab8a6d69a2 GitLab: #586
This commit is contained in:
parent
87b983af90
commit
3dd206e6f0
6 changed files with 79 additions and 59 deletions
|
@ -92,18 +92,18 @@ AvAdapter::shareEntireScreen(int screenNumber)
|
|||
QRect rect = screen->geometry();
|
||||
|
||||
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||
rect.x(),
|
||||
rect.y(),
|
||||
rect.width() * screen->devicePixelRatio(),
|
||||
rect.height() * screen->devicePixelRatio());
|
||||
rect.x(),
|
||||
rect.y(),
|
||||
rect.width() * screen->devicePixelRatio(),
|
||||
rect.height() * screen->devicePixelRatio());
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(
|
||||
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -117,13 +117,13 @@ AvAdapter::shareAllScreens()
|
|||
arrangementRect.width(),
|
||||
arrangementRect.height());
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(
|
||||
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -184,7 +184,7 @@ void
|
|||
AvAdapter::shareFile(const QString& filePath)
|
||||
{
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
if (!callId.isEmpty()) {
|
||||
if (!callId.isEmpty()) {
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
|
@ -207,33 +207,34 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig
|
|||
x = y = width = height = 0;
|
||||
xrectsel(&x, &y, &width, &height);
|
||||
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||
x,
|
||||
y,
|
||||
width < 128 ? 128 : width,
|
||||
height < 128 ? 128 : height);
|
||||
x,
|
||||
y,
|
||||
width < 128 ? 128 : width,
|
||||
height < 128 ? 128 : height);
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(
|
||||
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
});
|
||||
#else
|
||||
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||
x,
|
||||
y,
|
||||
width < 128 ? 128 : width,
|
||||
height < 128 ? 128 : height);
|
||||
x,
|
||||
y,
|
||||
width < 128 ? 128 : width,
|
||||
height < 128 ? 128 : height);
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(
|
||||
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
resource,
|
||||
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||
false);
|
||||
set_currentRenderingDeviceType(lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -242,16 +243,14 @@ AvAdapter::stopSharing()
|
|||
{
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
if (!callId.isEmpty()) {
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||
lrc::api::NewCallModel::MediaRequestType::CAMERA,
|
||||
false);
|
||||
lrcInstance_->avModel().switchInputTo(lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||
callId);
|
||||
set_currentRenderingDeviceType(
|
||||
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||
lrcInstance_->avModel().switchInputTo(lrcInstance_->avModel().getDefaultDevice(), callId);
|
||||
lrcInstance_->getCurrentCallModel()
|
||||
->requestMediaChange(callId,
|
||||
"video_0",
|
||||
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||
lrc::api::NewCallModel::MediaRequestType::CAMERA,
|
||||
muteCamera_);
|
||||
set_currentRenderingDeviceType(lrc::api::video::DeviceType::CAMERA);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class AvAdapter final : public QmlAdapterBase
|
|||
{
|
||||
Q_OBJECT
|
||||
QML_RO_PROPERTY(lrc::api::video::DeviceType, currentRenderingDeviceType)
|
||||
QML_PROPERTY(bool, muteCamera)
|
||||
|
||||
public:
|
||||
explicit AvAdapter(LRCInstance* instance, QObject* parent = nullptr);
|
||||
|
|
|
@ -650,7 +650,7 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
|
|||
bool isPaused = call->status == lrc::api::call::Status::PAUSED;
|
||||
bool isAudioOnly = call->isAudioOnly && !isPaused;
|
||||
bool isAudioMuted = call->audioMuted && (call->status != lrc::api::call::Status::PAUSED);
|
||||
bool isVideoMuted = call->videoMuted && !isPaused;
|
||||
bool isVideoMuted = call->isAudioOnly || (call->videoMuted && !isPaused);
|
||||
bool isRecording = isRecordingThisCall();
|
||||
bool isConferenceCall = !convInfo.confId.isEmpty()
|
||||
|| (convInfo.confId.isEmpty() && call->participantsInfos.size() != 0);
|
||||
|
|
|
@ -175,7 +175,12 @@ Control {
|
|||
},
|
||||
Action {
|
||||
id: muteVideoAction
|
||||
onTriggered: CallAdapter.videoPauseThisCallToggle(!isVideoMuted)
|
||||
onTriggered: {
|
||||
if (AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE) {
|
||||
AvAdapter.stopSharing()
|
||||
} else
|
||||
CallAdapter.videoPauseThisCallToggle(!isVideoMuted)
|
||||
}
|
||||
checkable: true
|
||||
icon.source: checked ?
|
||||
JamiResources.videocam_off_24dp_svg :
|
||||
|
|
|
@ -69,6 +69,7 @@ Item {
|
|||
root.isAudioOnly = isAudioOnly
|
||||
root.isAudioMuted = isAudioMuted
|
||||
root.isVideoMuted = isVideoMuted
|
||||
callViewContextMenu.isVideoMuted = root.isVideoMuted
|
||||
root.isRecording = isRecording
|
||||
root.isSIP = isSIP
|
||||
root.isConferenceCall = isConferenceCall
|
||||
|
@ -137,7 +138,12 @@ Item {
|
|||
|
||||
mode: JamiFileDialog.Mode.OpenFile
|
||||
|
||||
onAccepted: AvAdapter.shareFile(jamiFileDialog.file)
|
||||
onAccepted: {
|
||||
if (AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY && AvAdapter.currentRenderingDeviceType !== Video.DeviceType.FILE) {
|
||||
AvAdapter.muteCamera = root.isVideoMuted
|
||||
}
|
||||
AvAdapter.shareFile(jamiFileDialog.file)
|
||||
}
|
||||
}
|
||||
|
||||
ResponsiveImage {
|
||||
|
@ -160,6 +166,9 @@ Item {
|
|||
}
|
||||
|
||||
function openShareScreen() {
|
||||
if (AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY && AvAdapter.currentRenderingDeviceType !== Video.DeviceType.FILE) {
|
||||
AvAdapter.muteCamera = root.isVideoMuted
|
||||
}
|
||||
if (Qt.application.screens.length === 1) {
|
||||
AvAdapter.shareEntireScreen(0)
|
||||
} else {
|
||||
|
@ -169,6 +178,9 @@ Item {
|
|||
}
|
||||
|
||||
function openShareScreenArea() {
|
||||
if (AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY && AvAdapter.currentRenderingDeviceType !== Video.DeviceType.FILE) {
|
||||
AvAdapter.muteCamera = root.isVideoMuted
|
||||
}
|
||||
if (Qt.platform.os !== "windows") {
|
||||
AvAdapter.shareScreenArea(0, 0, 0, 0)
|
||||
} else {
|
||||
|
@ -207,7 +219,6 @@ Item {
|
|||
|
||||
isSIP: root.isSIP
|
||||
isPaused: root.isPaused
|
||||
isAudioOnly: root.isAudioOnly
|
||||
localIsRecording: root.isRecording
|
||||
|
||||
onTransferCallButtonClicked: openContactPicker(ContactList.TRANSFER)
|
||||
|
|
|
@ -34,7 +34,7 @@ ContextMenuAutoLoader {
|
|||
|
||||
property bool isSIP: false
|
||||
property bool isPaused: false
|
||||
property bool isAudioOnly: false
|
||||
property bool isVideoMuted: false
|
||||
property bool localIsRecording: false
|
||||
property bool peerIsRecording: false
|
||||
|
||||
|
@ -101,14 +101,12 @@ ContextMenuAutoLoader {
|
|||
GeneralMenuItem {
|
||||
id: stopSharing
|
||||
|
||||
canTrigger: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY
|
||||
&& !isSIP
|
||||
canTrigger: (AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE)
|
||||
&& !isSIP && !isVideoMuted
|
||||
itemName: JamiStrings.stopSharing
|
||||
iconSource: JamiResources.share_stop_black_24dp_svg
|
||||
iconColor: JamiTheme.redColor
|
||||
onClicked: {
|
||||
AvAdapter.stopSharing()
|
||||
}
|
||||
onClicked: AvAdapter.stopSharing()
|
||||
},
|
||||
GeneralMenuItem {
|
||||
id: shareScreen
|
||||
|
@ -118,6 +116,9 @@ ContextMenuAutoLoader {
|
|||
itemName: JamiStrings.shareScreen
|
||||
iconSource: JamiResources.share_screen_black_24dp_svg
|
||||
onClicked: {
|
||||
if (AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY && AvAdapter.currentRenderingDeviceType !== Video.DeviceType.FILE) {
|
||||
AvAdapter.muteCamera = root.isVideoMuted
|
||||
}
|
||||
if (Qt.application.screens.length === 1) {
|
||||
AvAdapter.shareEntireScreen(0)
|
||||
} else {
|
||||
|
@ -134,6 +135,9 @@ ContextMenuAutoLoader {
|
|||
itemName: JamiStrings.shareScreenArea
|
||||
iconSource: JamiResources.share_screen_black_24dp_svg
|
||||
onClicked: {
|
||||
if (AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY && AvAdapter.currentRenderingDeviceType !== Video.DeviceType.FILE) {
|
||||
AvAdapter.muteCamera = root.isVideoMuted
|
||||
}
|
||||
if (Qt.platform.os !== "windows") {
|
||||
AvAdapter.shareScreenArea(0, 0, 0, 0)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue