video_mixer: fix setActiveParticipant(nullptr)

setActiveParticipant(nullptr) is the only way for now to set the active
participant to the local video. But the local video is not necessarely
the first one. So, sometimes, setActiveParticipant(nullptr) was choosing
another active participant instead the local one.

Change-Id: I868770beb042977ce5ddd0f2dce00451cac04323
parent e6472cc5
......@@ -132,7 +132,7 @@ VideoMixer::stopInput()
void
VideoMixer::setActiveParticipant(Observable<std::shared_ptr<MediaFrame>>* ob)
{
activeSource_ = ob;
activeSource_ = ob ? ob : videoLocal_.get();
layoutUpdated_ += 1;
}
......@@ -157,7 +157,7 @@ VideoMixer::detached(Observable<std::shared_ptr<MediaFrame>>* ob)
// Handle the case where the current shown source leave the conference
if (activeSource_ == ob) {
currentLayout_ = Layout::GRID;
activeSource_ = nullptr;
activeSource_ = videoLocal_.get();
}
sources_.remove(x);
layoutUpdated_ += 1;
......@@ -219,8 +219,7 @@ VideoMixer::process()
return;
if (currentLayout_ != Layout::ONE_BIG or activeSource_ == x->source
or (not activeSource_
and not activeFound) /* By default ONE_BIG will show the first source */) {
or not activeFound /* By default ONE_BIG will show the first source */) {
// make rendered frame temporarily unavailable for update()
// to avoid concurrent access.
std::unique_ptr<VideoFrame> input;
......@@ -231,9 +230,6 @@ VideoMixer::process()
wantedIndex = 0;
activeFound = true;
} else if (currentLayout_ == Layout::ONE_BIG_WITH_SMALL) {
if (!activeSource_ && i == 0) {
activeFound = true;
}
if (activeSource_ == x->source) {
wantedIndex = 0;
activeFound = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment