Skip to content
Snippets Groups Projects
Commit 2c615dbc authored by Page Magnier-Slimani's avatar Page Magnier-Slimani Committed by François-Simon Fauteux-Chapleau
Browse files

ScreenSharing: allow for custom FPS video streams

The previews of the tabs and screens during the selection is only ran
at 1 FPS to limit memory usage.

jami-client-qt#1242

Change-Id: I63739a1716afa82cb1c8e3961dde01d8600bae13
parent 6402af90
Branches
No related tags found
No related merge requests found
......@@ -59,7 +59,8 @@ class VideoDeviceImpl {
FrameRate rate_ {};
std::map<VideoSize, std::vector<FrameRate>> available_rates_;
FrameRate desktopFrameRate_ = {30};
std::vector<FrameRate> desktopFrameRates_ = {FrameRate(5),
std::vector<FrameRate> desktopFrameRates_ = {FrameRate(1),
FrameRate(5),
FrameRate(10),
FrameRate(15),
FrameRate(20),
......
......@@ -537,7 +537,8 @@ vector<FrameRate>
VideoDeviceImpl::getRateList(const string& channel, VideoSize size) const
{
if (unique_id == DEVICE_DESKTOP) {
return {FrameRate(5),
return {FrameRate(1),
FrameRate(5),
FrameRate(10),
FrameRate(15),
FrameRate(20),
......
......@@ -433,9 +433,18 @@ VideoInput::initLinuxGrab(const std::string& display)
DeviceParams p = jami::getVideoDeviceMonitor().getDeviceParams(DEVICE_DESKTOP);
if (winIdPos != std::string::npos) {
p.window_id = display.substr(winIdPos + windowIdStr.size()); // "0x0340021e";
size_t endPos = display.find(' ', winIdPos + windowIdStr.size());
p.window_id = display.substr(winIdPos + windowIdStr.size(),
endPos - (winIdPos + windowIdStr.size())); // "0x0340021e";
p.is_area = 0;
}
std::string fpsStr = "fps:";
if (display.find(fpsStr) != std::string::npos) {
size_t fpsPos = display.find(fpsStr) + fpsStr.size();
int fps = std::stoi(display.substr(fpsPos));
p.framerate = fps;
JAMI_LOG("Custom framerate set to {} fps", fps);
}
if (display.find("pipewire") != std::string::npos) {
std::string pidStr = "pid:";
std::string fdStr = "fd:";
......@@ -534,8 +543,11 @@ VideoInput::initWindowsGrab(const std::string& display)
DeviceParams p = jami::getVideoDeviceMonitor().getDeviceParams(DEVICE_DESKTOP);
if (winHandlePos != std::string::npos) {
p.input = display.substr(winHandlePos + windowIdStr.size()); // "HANDLE";
p.name = display.substr(winHandlePos + windowIdStr.size()); // "HANDLE";
size_t endPos = display.find(' ', winHandlePos + windowIdStr.size());
p.input = display.substr(winHandlePos + windowIdStr.size(),
endPos - (winHandlePos + windowIdStr.size())); // "HANDLE";
p.name = display.substr(winHandlePos + windowIdStr.size(),
endPos - (winHandlePos + windowIdStr.size())); // "HANDLE";
p.is_area = 0;
} else {
p.input = display.substr(1);
......@@ -562,6 +574,13 @@ VideoInput::initWindowsGrab(const std::string& display)
p.height = default_grab_height;
}
}
std::string fpsStr = "fps:";
if (display.find(fpsStr) != std::string::npos) {
size_t fpsPos = display.find(fpsStr) + fpsStr.size();
int fps = std::stoi(display.substr(fpsPos));
p.framerate = fps;
JAMI_LOG("Custom framerate set to {} fps", fps);
}
auto dec = std::make_unique<MediaDecoder>();
if (dec->openInput(p) < 0 || dec->setupVideo() < 0)
......
......@@ -80,7 +80,8 @@ VideoDeviceImpl::setup()
name = DEVICE_DESKTOP;
VideoSize size {0, 0};
sizeList_.emplace_back(size);
rateList_[size] = {FrameRate(5),
rateList_[size] = {FrameRate(1),
FrameRate(5),
FrameRate(10),
FrameRate(15),
FrameRate(20),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment