Start using webrtc::VideoTrack.

This commit is contained in:
John Preston 2020-07-17 22:59:38 +04:00
parent 16177eae2b
commit f3808bdc24
3 changed files with 21 additions and 12 deletions

View File

@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/audio/media_audio_track.h"
#include "base/platform/base_platform_info.h"
#include "calls/calls_panel.h"
#include "webrtc/webrtc_video_sink.h"
#include "webrtc/webrtc_video_track.h"
#include "data/data_user.h"
#include "data/data_session.h"
#include "facades.h"
@ -758,17 +758,21 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
if (_muted.current()) {
raw->setMuteMicrophone(_muted.current());
}
_videoTrack = std::make_shared<webrtc::VideoTrack>();
_videoTrack->renderNextFrame(
) | rpl::start_with_next([=] {
if (_remoteVideoInactiveFrom > 0
&& (_remoteVideoInactiveFrom + kDropFramesWhileInactive
> crl::now())) {
} else {
_frames.fire_copy(_videoTrack->frame(webrtc::FrameRequest()));
_videoTrack->markFrameShown();
}
}, lifetime());
raw->setIncomingVideoOutput(_videoTrack->sink());
const auto &settings = Core::App().settings();
raw->setIncomingVideoOutput(webrtc::CreateVideoSink([=](QImage frame) {
crl::on_main(weak, [=] {
if (_remoteVideoInactiveFrom > 0
&& (_remoteVideoInactiveFrom + kDropFramesWhileInactive
> crl::now())) {
} else {
_frames.fire_copy(frame);
}
});
}));
raw->setAudioOutputDevice(
settings.callOutputDeviceID().toStdString());
raw->setAudioInputDevice(

View File

@ -26,6 +26,10 @@ enum class State;
enum class VideoState;
} // namespace tgcalls
namespace webrtc {
class VideoTrack;
} // namespace webrtc
namespace Calls {
struct DhConfig {
@ -227,6 +231,7 @@ private:
std::unique_ptr<tgcalls::Instance> _instance;
std::shared_ptr<tgcalls::VideoCaptureInterface> _videoCapture;
std::shared_ptr<webrtc::VideoTrack> _videoTrack;
std::unique_ptr<Media::Audio::Track> _waitingTrack;

@ -1 +1 @@
Subproject commit fa4c2e22d678d7a977b5f4572689e459be29b7e3
Subproject commit 817d74d734385fa4eb814c7f3ff0b4284b872b91