mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-29 19:03:03 +00:00
Add proof-of-concept screen sharing on macOS.
This commit is contained in:
parent
fef1f80570
commit
fb49b0ca27
@ -383,7 +383,14 @@ GroupCall::GroupCall(
|
||||
|
||||
GroupCall::~GroupCall() {
|
||||
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 {
|
||||
@ -402,7 +409,7 @@ void GroupCall::switchToScreenSharing() {
|
||||
if (isScreenSharing()) {
|
||||
return;
|
||||
}
|
||||
_videoDeviceId = "desktop_capturer_";
|
||||
_videoDeviceId = "desktop_capturer_screen_0";
|
||||
_videoCapture->switchToDevice(_videoDeviceId.toStdString());
|
||||
}
|
||||
|
||||
|
@ -650,14 +650,16 @@ auto Row::generatePaintUserpicCallback() -> PaintRoundImageCallback {
|
||||
? QSize(videoSize.width() * size / videoSize.height(), size)
|
||||
: QSize(size, videoSize.height() * size / videoSize.width());
|
||||
const auto request = Webrtc::FrameRequest{
|
||||
.resize = resize,
|
||||
.outer = QSize(size, size),
|
||||
.resize = resize * cIntRetinaFactor(),
|
||||
.outer = QSize(size, size) * cIntRetinaFactor(),
|
||||
};
|
||||
const auto frame = _videoTrackShown->frame(request);
|
||||
auto copy = frame; // #TODO calls optimize.
|
||||
copy.detach();
|
||||
Images::prepareCircle(copy);
|
||||
p.drawImage(x, y, copy);
|
||||
p.drawImage(
|
||||
QRect(QPoint(x, y), copy.size() / cIntRetinaFactor()),
|
||||
copy);
|
||||
_videoTrackShown->markFrameShown();
|
||||
return;
|
||||
} 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
|
||||
)
|
||||
|
||||
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
|
||||
PRIVATE
|
||||
desktop-app::external_webrtc
|
||||
@ -204,7 +191,22 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
)
|
||||
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}
|
||||
desktop_capturer/DesktopCaptureSourceView.h
|
||||
desktop_capturer/DesktopCaptureSourceView.mm
|
||||
platform/android/AndroidContext.cpp
|
||||
platform/android/AndroidContext.h
|
||||
platform/android/AndroidInterface.cpp
|
||||
|
@ -145,8 +145,18 @@ Open **x64 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
|
||||
cd win32\VS2015
|
||||
msbuild opus.sln /property:Configuration=Debug /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=%cd%\ThirdParty\msys64\usr\bin;%PATH%
|
||||
cd Libraries\win64
|
||||
|
@ -145,18 +145,18 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
|
||||
cd win32\VS2015
|
||||
msbuild opus.sln /property:Configuration=Debug /property:Platform="Win32"
|
||||
msbuild opus.sln /property:Configuration=Release /property:Platform="Win32"
|
||||
cd ..\..\..
|
||||
|
||||
git clone https://github.com/desktop-app/rnnoise.git
|
||||
cd rnnoise
|
||||
git checkout tdesktop
|
||||
mkdir out
|
||||
cd out
|
||||
cmake -A Win32 ..
|
||||
cmake --build . --config Debug
|
||||
cmake --build . --config Release
|
||||
cd ..
|
||||
cd ..\..
|
||||
|
||||
cd ..\..\..\..
|
||||
cd ..
|
||||
SET PATH_BACKUP_=%PATH%
|
||||
SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
|
||||
cd Libraries
|
||||
|
@ -97,7 +97,7 @@ Go to ***BuildPath*** and run
|
||||
make build_libs $MAKE_THREADS_CNT
|
||||
cd ..
|
||||
|
||||
git clone https://github.com/xiph/opus
|
||||
git clone https://github.com/xiph/opus.git
|
||||
cd opus
|
||||
git checkout v1.3
|
||||
./autogen.sh
|
||||
@ -106,6 +106,21 @@ Go to ***BuildPath*** and run
|
||||
sudo make install
|
||||
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
|
||||
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_ver.tar.gz
|
||||
tar -xvzf libiconv-$libiconv_ver.tar.gz
|
||||
|
Loading…
Reference in New Issue
Block a user