diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index 2a28e1b52fee3842b54c7848ad8a32c9741ec317..3ea7dd0a895a3e30833e46008e15836ae0317fef 100644 --- a/src/media/video/video_rtp_session.cpp +++ b/src/media/video/video_rtp_session.cpp @@ -530,6 +530,8 @@ void VideoRtpSession::setChangeOrientationCallback(std::function<void(int)> cb) { changeOrientationCallback_ = std::move(cb); + if (sender_) + sender_->setChangeOrientationCallback(changeOrientationCallback_); } float diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp index 71e5dccc19e7b8c1cc61cad4293dab2746a47318..995d71c2169928a5ed01ab42cb7b80234ad12043 100644 --- a/src/sip/sipcall.cpp +++ b/src/sip/sipcall.cpp @@ -912,6 +912,15 @@ SIPCall::startAllMedia() bool peer_holding {true}; int slotN = -1; +#ifdef ENABLE_VIDEO + videortp_->setChangeOrientationCallback([wthis = weak()] (int angle) { + runOnMainThread([wthis, angle] { + if (auto this_ = wthis.lock()) + this_->setVideoOrientation(angle); + }); + }); +#endif + for (const auto& slot : slots) { ++slotN; const auto& local = slot.first; @@ -998,12 +1007,6 @@ SIPCall::startAllMedia() this_->requestKeyframe(); }); }); - videortp_->setChangeOrientationCallback([wthis = weak()] (int angle) { - runOnMainThread([wthis, angle] { - if (auto this_ = wthis.lock()) - this_->setVideoOrientation(angle); - }); - }); #endif if (not isSubcall() and peerHolding_ != peer_holding) {