Skip to content
Snippets Groups Projects
Commit 021ab43d authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin
Browse files

calls: file/screen sharing in audio only calls

GitLab: #499
Change-Id: I76754b4b32cde4cf8445c6058649aab912d7a0b4
parent 641730c4
No related branches found
No related tags found
No related merge requests found
......@@ -91,12 +91,19 @@ AvAdapter::shareEntireScreen(int screenNumber)
return;
QRect rect = screen->geometry();
lrcInstance_->avModel().setDisplay(getScreenNumber(),
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
rect.x(),
rect.y(),
rect.width() * screen->devicePixelRatio(),
rect.height() * screen->devicePixelRatio(),
lrcInstance_->getCurrentCallId());
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);
}
void
......@@ -104,12 +111,19 @@ AvAdapter::shareAllScreens()
{
const auto arrangementRect = getAllScreensBoundingRect();
lrcInstance_->avModel().setDisplay(getScreenNumber(),
arrangementRect.x(),
arrangementRect.y(),
arrangementRect.width(),
arrangementRect.height(),
lrcInstance_->getCurrentCallId());
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
arrangementRect.x(),
arrangementRect.y(),
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);
}
void
......@@ -169,7 +183,17 @@ AvAdapter::captureAllScreens()
void
AvAdapter::shareFile(const QString& filePath)
{
lrcInstance_->avModel().setInputFile(filePath, lrcInstance_->getCurrentCallId());
auto callId = lrcInstance_->getCurrentCallId();
if (!callId.isEmpty()) {
lrcInstance_->getCurrentCallModel()
->requestMediaChange(callId,
"video_0",
filePath,
lrc::api::NewCallModel::MediaRequestType::FILESHARING,
false);
set_currentRenderingDeviceType(
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
}
}
void
......@@ -182,21 +206,34 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig
QTimer::singleShot(100, [=]() mutable {
x = y = width = height = 0;
xrectsel(&x, &y, &width, &height);
lrcInstance_->avModel().setDisplay(getScreenNumber(),
x,
y,
width < 128 ? 128 : width,
height < 128 ? 128 : height,
lrcInstance_->getCurrentCallId());
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
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);
});
#else
lrcInstance_->avModel().setDisplay(getScreenNumber(),
x,
y,
width < 128 ? 128 : width,
height < 128 ? 128 : height,
lrcInstance_->getCurrentCallId());
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
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);
#endif
}
......@@ -204,9 +241,18 @@ void
AvAdapter::stopSharing()
{
auto callId = lrcInstance_->getCurrentCallId();
if (!callId.isEmpty())
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);
}
}
void
......
......@@ -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 && !call->isAudioOnly;
bool isVideoMuted = call->videoMuted && !isPaused;
bool isRecording = isRecordingThisCall();
bool isConferenceCall = !convInfo.confId.isEmpty()
|| (convInfo.confId.isEmpty() && call->participantsInfos.size() != 0);
......@@ -959,7 +959,7 @@ CallAdapter::holdThisCallToggle()
}
void
CallAdapter::muteThisCallToggle()
CallAdapter::muteThisCallToggle(bool mute)
{
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_);
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
......@@ -967,7 +967,11 @@ CallAdapter::muteThisCallToggle()
}
auto* callModel = lrcInstance_->getCurrentCallModel();
if (callModel->hasCall(callId)) {
callModel->requestMediaChange(callId, "audio_0");
callModel->requestMediaChange(callId,
"audio_0",
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
lrc::api::NewCallModel::MediaRequestType::CAMERA,
mute);
}
}
......@@ -985,7 +989,7 @@ CallAdapter::recordThisCallToggle()
}
void
CallAdapter::videoPauseThisCallToggle()
CallAdapter::videoPauseThisCallToggle(bool mute)
{
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_);
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
......@@ -993,7 +997,11 @@ CallAdapter::videoPauseThisCallToggle()
}
auto* callModel = lrcInstance_->getCurrentCallModel();
if (callModel->hasCall(callId)) {
callModel->requestMediaChange(callId, "video_0");
callModel->requestMediaChange(callId,
"video_0",
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
lrc::api::NewCallModel::MediaRequestType::CAMERA,
mute);
// media label should come from qml
// also thi function can me emrged with "muteThisCallToggle"
}
......
......@@ -69,9 +69,9 @@ public:
Q_INVOKABLE bool isModerator(const QString& uri = {}) const;
Q_INVOKABLE bool isCurrentModerator() const;
Q_INVOKABLE void holdThisCallToggle();
Q_INVOKABLE void muteThisCallToggle();
Q_INVOKABLE void muteThisCallToggle(bool mute);
Q_INVOKABLE void recordThisCallToggle();
Q_INVOKABLE void videoPauseThisCallToggle();
Q_INVOKABLE void videoPauseThisCallToggle(bool mute);
Q_INVOKABLE bool isRecordingThisCall();
Q_INVOKABLE QVariantList getConferencesInfos();
Q_INVOKABLE void muteParticipant(const QString& uri, const bool state);
......
......@@ -156,7 +156,7 @@ Control {
property list<Action> primaryActions: [
Action {
id: muteAudioAction
onTriggered: CallAdapter.muteThisCallToggle()
onTriggered: CallAdapter.muteThisCallToggle(!isAudioMuted)
checkable: true
icon.source: checked ?
JamiResources.mic_off_24dp_svg :
......@@ -175,7 +175,7 @@ Control {
},
Action {
id: muteVideoAction
onTriggered: CallAdapter.videoPauseThisCallToggle()
onTriggered: CallAdapter.videoPauseThisCallToggle(!isVideoMuted)
checkable: true
icon.source: checked ?
JamiResources.videocam_off_24dp_svg :
......@@ -237,17 +237,17 @@ Control {
Action {
id: shareAction
onTriggered: {
if (AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY)
if (AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE)
root.stopSharingClicked()
else
root.shareScreenClicked()
}
icon.source: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY ?
icon.source: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE ?
JamiResources.share_stop_black_24dp_svg :
JamiResources.share_screen_black_24dp_svg
icon.color: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY ?
icon.color: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE ?
"red" : "white"
text: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY ?
text: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE ?
JamiStrings.stopSharing :
JamiStrings.shareScreen
property real size: 34
......@@ -308,7 +308,7 @@ Control {
CallOverlayModel.addSecondaryControl(callTransferAction)
}
CallOverlayModel.addSecondaryControl(chatAction)
if (!isAudioOnly && !isSIP)
if (!isSIP)
CallOverlayModel.addSecondaryControl(shareAction)
CallOverlayModel.addSecondaryControl(recordAction)
CallOverlayModel.addSecondaryControl(pluginsAction)
......
......@@ -101,8 +101,7 @@ ContextMenuAutoLoader {
GeneralMenuItem {
id: stopSharing
canTrigger: !isAudioOnly
&& AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY
canTrigger: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY
&& !isSIP
itemName: JamiStrings.stopSharing
iconSource: JamiResources.share_stop_black_24dp_svg
......@@ -114,8 +113,7 @@ ContextMenuAutoLoader {
GeneralMenuItem {
id: shareScreen
canTrigger: !isAudioOnly
&& AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
canTrigger: AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
&& !isSIP
itemName: JamiStrings.shareScreen
iconSource: JamiResources.share_screen_black_24dp_svg
......@@ -131,8 +129,7 @@ ContextMenuAutoLoader {
GeneralMenuItem {
id: shareScreenArea
canTrigger: !isAudioOnly
&& AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
canTrigger: AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
&& !isSIP
itemName: JamiStrings.shareScreenArea
iconSource: JamiResources.share_screen_black_24dp_svg
......@@ -148,7 +145,7 @@ ContextMenuAutoLoader {
GeneralMenuItem {
id: shareFile
canTrigger: !isAudioOnly && !isSIP
canTrigger: !isSIP
itemName: JamiStrings.shareFile
iconSource: JamiResources.insert_photo_24dp_svg
onClicked: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment