mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add proof-of-concept screen sharing on macOS.
This commit is contained in:
parent
fef1f80570
commit
fb49b0ca27
7 changed files with 60 additions and 24 deletions
|
@ -383,7 +383,14 @@ GroupCall::GroupCall(
|
||||||
|
|
||||||
GroupCall::~GroupCall() {
|
GroupCall::~GroupCall() {
|
||||||
destroyController();
|
destroyController();
|
||||||
switchToCamera();
|
const auto wasScreenSharing = isScreenSharing();
|
||||||
|
const auto weak = wasScreenSharing
|
||||||
|
? std::weak_ptr<tgcalls::VideoCaptureInterface>(_videoCapture)
|
||||||
|
: std::weak_ptr<tgcalls::VideoCaptureInterface>();
|
||||||
|
_videoCapture = nullptr;
|
||||||
|
if (const auto strong = weak.lock()) {
|
||||||
|
strong->switchToDevice(_videoDeviceId.toStdString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GroupCall::isScreenSharing() const {
|
bool GroupCall::isScreenSharing() const {
|
||||||
|
@ -402,7 +409,7 @@ void GroupCall::switchToScreenSharing() {
|
||||||
if (isScreenSharing()) {
|
if (isScreenSharing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_videoDeviceId = "desktop_capturer_";
|
_videoDeviceId = "desktop_capturer_screen_0";
|
||||||
_videoCapture->switchToDevice(_videoDeviceId.toStdString());
|
_videoCapture->switchToDevice(_videoDeviceId.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,14 +650,16 @@ auto Row::generatePaintUserpicCallback() -> PaintRoundImageCallback {
|
||||||
? QSize(videoSize.width() * size / videoSize.height(), size)
|
? QSize(videoSize.width() * size / videoSize.height(), size)
|
||||||
: QSize(size, videoSize.height() * size / videoSize.width());
|
: QSize(size, videoSize.height() * size / videoSize.width());
|
||||||
const auto request = Webrtc::FrameRequest{
|
const auto request = Webrtc::FrameRequest{
|
||||||
.resize = resize,
|
.resize = resize * cIntRetinaFactor(),
|
||||||
.outer = QSize(size, size),
|
.outer = QSize(size, size) * cIntRetinaFactor(),
|
||||||
};
|
};
|
||||||
const auto frame = _videoTrackShown->frame(request);
|
const auto frame = _videoTrackShown->frame(request);
|
||||||
auto copy = frame; // #TODO calls optimize.
|
auto copy = frame; // #TODO calls optimize.
|
||||||
copy.detach();
|
copy.detach();
|
||||||
Images::prepareCircle(copy);
|
Images::prepareCircle(copy);
|
||||||
p.drawImage(x, y, copy);
|
p.drawImage(
|
||||||
|
QRect(QPoint(x, y), copy.size() / cIntRetinaFactor()),
|
||||||
|
copy);
|
||||||
_videoTrackShown->markFrameShown();
|
_videoTrackShown->markFrameShown();
|
||||||
return;
|
return;
|
||||||
} else if (_videoTrackShown) {
|
} else if (_videoTrackShown) {
|
||||||
|
|
2
Telegram/ThirdParty/tgcalls
vendored
2
Telegram/ThirdParty/tgcalls
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 082b938cbfef6539bdf6b71f9b46f9c2b2880d24
|
Subproject commit 01c03d7b4cfd7c02c79bab32cc2e688316d1a450
|
|
@ -139,19 +139,6 @@ PRIVATE
|
||||||
reference/InstanceImplReference.h
|
reference/InstanceImplReference.h
|
||||||
)
|
)
|
||||||
|
|
||||||
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
|
||||||
desktop_capturer/DesktopCaptureSource.h
|
|
||||||
desktop_capturer/DesktopCaptureSource.mm
|
|
||||||
desktop_capturer/DesktopCaptureSourceHelper.h
|
|
||||||
desktop_capturer/DesktopCaptureSourceHelper.mm
|
|
||||||
desktop_capturer/DesktopCaptureSourceManager.h
|
|
||||||
desktop_capturer/DesktopCaptureSourceManager.mm
|
|
||||||
desktop_capturer/DesktopCaptureSourceView.h
|
|
||||||
desktop_capturer/DesktopCaptureSourceView.mm
|
|
||||||
desktop_capturer/DesktopSharingCapturer.h
|
|
||||||
desktop_capturer/DesktopSharingCapturer.mm
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(lib_tgcalls
|
target_link_libraries(lib_tgcalls
|
||||||
PRIVATE
|
PRIVATE
|
||||||
desktop-app::external_webrtc
|
desktop-app::external_webrtc
|
||||||
|
@ -204,7 +191,22 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (NOT APPLE)
|
||||||
|
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
||||||
|
desktop_capturer/DesktopCaptureSource.h
|
||||||
|
desktop_capturer/DesktopCaptureSource.mm
|
||||||
|
desktop_capturer/DesktopCaptureSourceHelper.h
|
||||||
|
desktop_capturer/DesktopCaptureSourceHelper.mm
|
||||||
|
desktop_capturer/DesktopCaptureSourceManager.h
|
||||||
|
desktop_capturer/DesktopCaptureSourceManager.mm
|
||||||
|
desktop_capturer/DesktopSharingCapturer.h
|
||||||
|
desktop_capturer/DesktopSharingCapturer.mm
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
||||||
|
desktop_capturer/DesktopCaptureSourceView.h
|
||||||
|
desktop_capturer/DesktopCaptureSourceView.mm
|
||||||
platform/android/AndroidContext.cpp
|
platform/android/AndroidContext.cpp
|
||||||
platform/android/AndroidContext.h
|
platform/android/AndroidContext.h
|
||||||
platform/android/AndroidInterface.cpp
|
platform/android/AndroidInterface.cpp
|
||||||
|
|
|
@ -145,8 +145,18 @@ Open **x64 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
|
||||||
cd win32\VS2015
|
cd win32\VS2015
|
||||||
msbuild opus.sln /property:Configuration=Debug /property:Platform="x64"
|
msbuild opus.sln /property:Configuration=Debug /property:Platform="x64"
|
||||||
msbuild opus.sln /property:Configuration=Release /property:Platform="x64"
|
msbuild opus.sln /property:Configuration=Release /property:Platform="x64"
|
||||||
|
cd ..\..\..
|
||||||
|
|
||||||
cd ..\..\..\..\..
|
git clone https://github.com/desktop-app/rnnoise.git
|
||||||
|
cd rnnoise
|
||||||
|
mkdir out
|
||||||
|
cd out
|
||||||
|
cmake -A x64 ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
cmake --build . --config Release
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
|
cd ..\..
|
||||||
SET PATH_BACKUP_=%PATH%
|
SET PATH_BACKUP_=%PATH%
|
||||||
SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
|
SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
|
||||||
cd Libraries\win64
|
cd Libraries\win64
|
||||||
|
|
|
@ -145,18 +145,18 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
|
||||||
cd win32\VS2015
|
cd win32\VS2015
|
||||||
msbuild opus.sln /property:Configuration=Debug /property:Platform="Win32"
|
msbuild opus.sln /property:Configuration=Debug /property:Platform="Win32"
|
||||||
msbuild opus.sln /property:Configuration=Release /property:Platform="Win32"
|
msbuild opus.sln /property:Configuration=Release /property:Platform="Win32"
|
||||||
|
cd ..\..\..
|
||||||
|
|
||||||
git clone https://github.com/desktop-app/rnnoise.git
|
git clone https://github.com/desktop-app/rnnoise.git
|
||||||
cd rnnoise
|
cd rnnoise
|
||||||
git checkout tdesktop
|
|
||||||
mkdir out
|
mkdir out
|
||||||
cd out
|
cd out
|
||||||
cmake -A Win32 ..
|
cmake -A Win32 ..
|
||||||
cmake --build . --config Debug
|
cmake --build . --config Debug
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
cd ..
|
cd ..\..
|
||||||
|
|
||||||
cd ..\..\..\..
|
cd ..
|
||||||
SET PATH_BACKUP_=%PATH%
|
SET PATH_BACKUP_=%PATH%
|
||||||
SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
|
SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
|
||||||
cd Libraries
|
cd Libraries
|
||||||
|
|
|
@ -97,7 +97,7 @@ Go to ***BuildPath*** and run
|
||||||
make build_libs $MAKE_THREADS_CNT
|
make build_libs $MAKE_THREADS_CNT
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone https://github.com/xiph/opus
|
git clone https://github.com/xiph/opus.git
|
||||||
cd opus
|
cd opus
|
||||||
git checkout v1.3
|
git checkout v1.3
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
@ -106,6 +106,21 @@ Go to ***BuildPath*** and run
|
||||||
sudo make install
|
sudo make install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
git clone https://github.com/desktop-app/rnnoise.git
|
||||||
|
cd rnnoise
|
||||||
|
mkdir out
|
||||||
|
cd out
|
||||||
|
mkdir Debug
|
||||||
|
cd Debug
|
||||||
|
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../..
|
||||||
|
ninja
|
||||||
|
cd ..
|
||||||
|
mkdir Release
|
||||||
|
cd Release
|
||||||
|
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ../..
|
||||||
|
ninja
|
||||||
|
cd ../../..
|
||||||
|
|
||||||
libiconv_ver=1.16
|
libiconv_ver=1.16
|
||||||
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_ver.tar.gz
|
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_ver.tar.gz
|
||||||
tar -xvzf libiconv-$libiconv_ver.tar.gz
|
tar -xvzf libiconv-$libiconv_ver.tar.gz
|
||||||
|
|
Loading…
Add table
Reference in a new issue