mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-17 07:53:24 +08:00
windowsharing: set the preview to 1 FPS
Set the preview of the windows shared at one FPS and allows to set custom FPS count to a window. GitLab: #1242 Change-Id: Ia189500267de18d0809d8d4db781c7015623fa8c
This commit is contained in:
committed by
François-Simon Fauteux-Chapleau
parent
ff5f94b34a
commit
b5dbe23c17
2
daemon
2
daemon
Submodule daemon updated: 95832cfc9d...2c615dbc8a
@@ -345,9 +345,11 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig
|
||||
}
|
||||
|
||||
void
|
||||
AvAdapter::shareWindow(const QString& windowProcessId, const QString& windowId)
|
||||
AvAdapter::shareWindow(const QString& windowProcessId, const QString& windowId, const int fps)
|
||||
{
|
||||
auto resource = lrcInstance_->getCurrentCallModel()->getDisplay(windowProcessId, windowId);
|
||||
auto resource = lrcInstance_->getCurrentCallModel()->getDisplay(windowProcessId,
|
||||
windowId,
|
||||
fps);
|
||||
auto callId = lrcInstance_->getCurrentCallId();
|
||||
|
||||
muteCamera_ = !isCapturing();
|
||||
@@ -356,7 +358,10 @@ AvAdapter::shareWindow(const QString& windowProcessId, const QString& windowId)
|
||||
}
|
||||
|
||||
QString
|
||||
AvAdapter::getSharingResource(int screenId, const QString& windowProcessId, const QString& windowId)
|
||||
AvAdapter::getSharingResource(int screenId,
|
||||
const QString& windowProcessId,
|
||||
const QString& windowId,
|
||||
const int fps)
|
||||
{
|
||||
if (screenId == -1) {
|
||||
const auto arrangementRect = getAllScreensBoundingRect();
|
||||
@@ -387,7 +392,7 @@ AvAdapter::getSharingResource(int screenId, const QString& windowProcessId, cons
|
||||
rect.height()
|
||||
* screen->devicePixelRatio());
|
||||
} else if (!windowId.isEmpty()) {
|
||||
return lrcInstance_->getCurrentCallModel()->getDisplay(windowProcessId, windowId);
|
||||
return lrcInstance_->getCurrentCallModel()->getDisplay(windowProcessId, windowId, fps);
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
@@ -96,7 +96,9 @@ protected:
|
||||
Q_INVOKABLE void shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned height);
|
||||
|
||||
// Select window to display (all platforms except Wayland).
|
||||
Q_INVOKABLE void shareWindow(const QString& windowProcessId, const QString& windowId);
|
||||
Q_INVOKABLE void shareWindow(const QString& windowProcessId,
|
||||
const QString& windowId,
|
||||
const int fps = -1);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// Share a window on Wayland.
|
||||
@@ -110,7 +112,8 @@ protected:
|
||||
// Returns the screensharing resource
|
||||
Q_INVOKABLE QString getSharingResource(int screenId = -2,
|
||||
const QString& windowProcessId = "",
|
||||
const QString& key = "");
|
||||
const QString& key = "",
|
||||
const int fps = -1);
|
||||
|
||||
Q_INVOKABLE void getListWindows();
|
||||
|
||||
|
||||
@@ -49,35 +49,33 @@ Window {
|
||||
function calculateRepeaterModel() {
|
||||
var newModel = [];
|
||||
var idx;
|
||||
|
||||
if (!showWindows) {
|
||||
for (idx in Qt.application.screens) {
|
||||
newModel.push({
|
||||
title: JamiStrings.screen.arg(idx),
|
||||
index: parseInt(idx),
|
||||
isAllScreens: false
|
||||
});
|
||||
title: JamiStrings.screen.arg(idx),
|
||||
index: parseInt(idx),
|
||||
isAllScreens: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
AvAdapter.getListWindows();
|
||||
for (idx in AvAdapter.windowsNames) {
|
||||
newModel.push({
|
||||
title: AvAdapter.windowsNames[idx],
|
||||
index: parseInt(idx),
|
||||
isAllScreens: false
|
||||
});
|
||||
title: AvAdapter.windowsNames[idx],
|
||||
index: parseInt(idx),
|
||||
isAllScreens: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Add "All Screens" option for non-Windows platforms when showing screens
|
||||
if (!showWindows && Qt.application.screens.length > 1 && Qt.platform.os.toString() !== "windows") {
|
||||
newModel.unshift({
|
||||
title: JamiStrings.allScreens,
|
||||
index: -1,
|
||||
isAllScreens: true
|
||||
});
|
||||
title: JamiStrings.allScreens,
|
||||
index: -1,
|
||||
isAllScreens: true
|
||||
});
|
||||
}
|
||||
|
||||
listModel = newModel;
|
||||
}
|
||||
|
||||
@@ -129,7 +127,7 @@ Window {
|
||||
var calculatedWidth = Math.floor(width / cellsPerRow);
|
||||
return Math.max(componentMinWidth, calculatedWidth);
|
||||
}
|
||||
cellHeight: cellWidth * 3/4 + marginSize * 2
|
||||
cellHeight: cellWidth * 3 / 4 + marginSize * 2
|
||||
|
||||
model: listModel
|
||||
|
||||
@@ -137,8 +135,7 @@ Window {
|
||||
width: screenGrid.cellWidth - marginSize
|
||||
height: screenGrid.cellHeight - marginSize
|
||||
|
||||
visible: JamiStrings.selectScreen !== modelData.title &&
|
||||
JamiStrings.selectWindow !== modelData.title
|
||||
visible: JamiStrings.selectScreen !== modelData.title && JamiStrings.selectWindow !== modelData.title
|
||||
|
||||
ScreenSharePreview {
|
||||
id: screenItem
|
||||
@@ -152,8 +149,7 @@ Window {
|
||||
if (modelData.isAllScreens)
|
||||
return AvAdapter.getSharingResource(-1);
|
||||
else if (showWindows)
|
||||
return AvAdapter.getSharingResource(-2, AvAdapter.windowsIds[modelData.index],
|
||||
AvAdapter.windowsNames[modelData.index]);
|
||||
return AvAdapter.getSharingResource(-2, AvAdapter.windowsIds[modelData.index], AvAdapter.windowsNames[modelData.index], 1);
|
||||
return AvAdapter.getSharingResource(modelData.index);
|
||||
}
|
||||
}
|
||||
@@ -192,8 +188,7 @@ Window {
|
||||
if (!showWindows)
|
||||
AvAdapter.shareEntireScreen(selectedScreenNumber);
|
||||
else {
|
||||
AvAdapter.shareWindow(AvAdapter.windowsIds[selectedScreenNumber],
|
||||
AvAdapter.windowsNames[selectedScreenNumber]);
|
||||
AvAdapter.shareWindow(AvAdapter.windowsIds[selectedScreenNumber], AvAdapter.windowsNames[selectedScreenNumber]);
|
||||
}
|
||||
}
|
||||
root.close();
|
||||
|
||||
@@ -406,7 +406,9 @@ public:
|
||||
* @param windowProcessId
|
||||
* @param windowId
|
||||
*/
|
||||
QString getDisplay(const QString& windowProcessId, const QString& windowId);
|
||||
QString getDisplay(const QString& windowProcessId,
|
||||
const QString& windowId,
|
||||
const int fps = -1);
|
||||
|
||||
void emplaceConversationConference(const QString& callId);
|
||||
|
||||
@@ -481,7 +483,9 @@ Q_SIGNALS:
|
||||
* @param conversationId
|
||||
* @param confId
|
||||
*/
|
||||
void callAddedToConference(const QString& callId, const QString& conversationId, const QString& confId) const;
|
||||
void callAddedToConference(const QString& callId,
|
||||
const QString& conversationId,
|
||||
const QString& confId) const;
|
||||
|
||||
/**
|
||||
* Emitted when a voice mail notice arrives
|
||||
|
||||
@@ -989,7 +989,7 @@ CallModel::getDisplay(int idx, int x, int y, int w, int h)
|
||||
}
|
||||
|
||||
QString
|
||||
CallModel::getDisplay(const QString& windowProcessId, const QString& windowId)
|
||||
CallModel::getDisplay(const QString& windowProcessId, const QString& windowId, const int fps)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
Q_UNUSED(windowProcessId)
|
||||
@@ -1010,6 +1010,11 @@ CallModel::getDisplay(const QString& windowProcessId, const QString& windowId)
|
||||
.arg(sep)
|
||||
.arg(windowProcessId);
|
||||
#endif
|
||||
// Usefull if the window is a preview to set a custom fps rate of 1
|
||||
if (fps > 0) {
|
||||
ret += QString(" fps:%1").arg(fps);
|
||||
}
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user