Skip to content
Snippets Groups Projects
Commit ef90dd18 authored by Pierre Lespagnol's avatar Pierre Lespagnol
Browse files

conference: fix participant resizing

Change-Id: If63fa7fb382bd32b2d8326875250099a252a1ac1
Gitlab: #503
parent 4ba5053d
No related branches found
No related tags found
No related merge requests found
...@@ -1012,11 +1012,10 @@ Conference::resizeRemoteParticipants(ConfInfo& confInfo, std::string_view peerUR ...@@ -1012,11 +1012,10 @@ Conference::resizeRemoteParticipants(ConfInfo& confInfo, std::string_view peerUR
} }
} }
// Do the resize for each remote participant
for (auto& remoteCell : confInfo) {
const float zoomX = (float) remoteFrameWidth / localCell.w; const float zoomX = (float) remoteFrameWidth / localCell.w;
const float zoomY = (float) remoteFrameHeight / localCell.h; const float zoomY = (float) remoteFrameHeight / localCell.h;
// Do the resize for each remote participant
for (auto& remoteCell : confInfo) {
remoteCell.x = remoteCell.x / zoomX + localCell.x; remoteCell.x = remoteCell.x / zoomX + localCell.x;
remoteCell.y = remoteCell.y / zoomY + localCell.y; remoteCell.y = remoteCell.y / zoomY + localCell.y;
remoteCell.w = remoteCell.w / zoomX; remoteCell.w = remoteCell.w / zoomX;
...@@ -1052,8 +1051,10 @@ Conference::mergeConfInfo(ConfInfo& newInfo, const std::string& peerURI) ...@@ -1052,8 +1051,10 @@ Conference::mergeConfInfo(ConfInfo& newInfo, const std::string& peerURI)
} }
// Send confInfo only if needed to avoid loops // Send confInfo only if needed to avoid loops
if (updateNeeded) { if (updateNeeded) {
std::lock_guard<std::mutex> lk(confInfoMutex_); // Trigger the layout update in the mixer because the frame resolution may
sendConferenceInfos(); // change from participant to conference and cause a mismatch between
// confInfo layout and rendering layout.
getVideoMixer()->updateLayout();
} }
} }
......
...@@ -178,13 +178,19 @@ void ...@@ -178,13 +178,19 @@ void
VideoMixer::setActiveHost() VideoMixer::setActiveHost()
{ {
activeSource_ = videoLocalSecondary_ ? videoLocalSecondary_.get() : videoLocal_.get(); activeSource_ = videoLocalSecondary_ ? videoLocalSecondary_.get() : videoLocal_.get();
layoutUpdated_ += 1; updateLayout();
} }
void void
VideoMixer::setActiveParticipant(Observable<std::shared_ptr<MediaFrame>>* ob) VideoMixer::setActiveParticipant(Observable<std::shared_ptr<MediaFrame>>* ob)
{ {
activeSource_ = ob; activeSource_ = ob;
updateLayout();
}
void
VideoMixer::updateLayout()
{
layoutUpdated_ += 1; layoutUpdated_ += 1;
} }
...@@ -197,7 +203,7 @@ VideoMixer::attached(Observable<std::shared_ptr<MediaFrame>>* ob) ...@@ -197,7 +203,7 @@ VideoMixer::attached(Observable<std::shared_ptr<MediaFrame>>* ob)
src->render_frame = std::make_shared<VideoFrame>(); src->render_frame = std::make_shared<VideoFrame>();
src->source = ob; src->source = ob;
sources_.emplace_back(std::move(src)); sources_.emplace_back(std::move(src));
layoutUpdated_ += 1; updateLayout();
} }
void void
...@@ -213,7 +219,7 @@ VideoMixer::detached(Observable<std::shared_ptr<MediaFrame>>* ob) ...@@ -213,7 +219,7 @@ VideoMixer::detached(Observable<std::shared_ptr<MediaFrame>>* ob)
activeSource_ = videoLocalSecondary_ ? videoLocalSecondary_.get() : videoLocal_.get(); activeSource_ = videoLocalSecondary_ ? videoLocalSecondary_.get() : videoLocal_.get();
} }
sources_.remove(x); sources_.remove(x);
layoutUpdated_ += 1; updateLayout();
break; break;
} }
} }
...@@ -285,7 +291,7 @@ VideoMixer::process() ...@@ -285,7 +291,7 @@ VideoMixer::process()
// If orientation changed or if the first valid frame for source // If orientation changed or if the first valid frame for source
// is received -> trigger layout calculation and confInfo update // is received -> trigger layout calculation and confInfo update
if (x->rotation != input->getOrientation() or !x->w or !x->h) { if (x->rotation != input->getOrientation() or !x->w or !x->h) {
layoutUpdated_ += 1; updateLayout();
needsUpdate = true; needsUpdate = true;
} }
...@@ -313,7 +319,7 @@ VideoMixer::process() ...@@ -313,7 +319,7 @@ VideoMixer::process()
auto hasVideo = x->hasVideo; auto hasVideo = x->hasVideo;
x->hasVideo = input && successfullyRendered; x->hasVideo = input && successfullyRendered;
if (hasVideo != x->hasVideo) { if (hasVideo != x->hasVideo) {
layoutUpdated_ += 1; updateLayout();
needsUpdate = true; needsUpdate = true;
} }
} else if (needsUpdate) { } else if (needsUpdate) {
...@@ -471,7 +477,7 @@ VideoMixer::setParameters(int width, int height, AVPixelFormat format) ...@@ -471,7 +477,7 @@ VideoMixer::setParameters(int width, int height, AVPixelFormat format)
libav_utils::fillWithBlack(previous_p->pointer()); libav_utils::fillWithBlack(previous_p->pointer());
start_sink(); start_sink();
layoutUpdated_ += 1; updateLayout();
startTime_ = av_gettime(); startTime_ = av_gettime();
} }
......
...@@ -89,6 +89,8 @@ public: ...@@ -89,6 +89,8 @@ public:
std::shared_ptr<VideoFrameActiveWriter>& getVideoLocal() { return videoLocal_; } std::shared_ptr<VideoFrameActiveWriter>& getVideoLocal() { return videoLocal_; }
void updateLayout();
private: private:
NON_COPYABLE(VideoMixer); NON_COPYABLE(VideoMixer);
struct VideoMixerSource; struct VideoMixerSource;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment