Skip to content
Snippets Groups Projects
Commit 6f64b069 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conference: sendConfInfo without camera

The video mixer was only initialized if the host got a camera or
if calls got some video. Now, the conf infos are sent if all calls
are audio only and if the host has no camera.

Change-Id: I69c9e773134b6ab4aab3e9462128ea841a09539e
parent 9ddc0c11
No related branches found
No related tags found
No related merge requests found
...@@ -91,10 +91,9 @@ Conference::Conference(const std::shared_ptr<Account>& account) ...@@ -91,10 +91,9 @@ Conference::Conference(const std::shared_ptr<Account>& account)
return attr.type_ == MediaType::MEDIA_VIDEO; return attr.type_ == MediaType::MEDIA_VIDEO;
}); });
// We are done if the video is disabled. // We are done if the video is disabled.
if (not videoEnabled_ || itVideo == hostSources_.end()) auto hasVideo = videoEnabled_ && itVideo != hostSources_.end();
return; auto source = hasVideo ? itVideo->sourceUri_ : "";
videoMixer_ = std::make_shared<video::VideoMixer>(id_, source, hasVideo);
videoMixer_ = std::make_shared<video::VideoMixer>(id_, itVideo->sourceUri_);
videoMixer_->setOnSourcesUpdated([this](std::vector<video::SourceInfo>&& infos) { videoMixer_->setOnSourcesUpdated([this](std::vector<video::SourceInfo>&& infos) {
runOnMainThread([w = weak(), infos = std::move(infos)] { runOnMainThread([w = weak(), infos = std::move(infos)] {
auto shared = w.lock(); auto shared = w.lock();
......
...@@ -81,14 +81,14 @@ private: ...@@ -81,14 +81,14 @@ private:
static constexpr const auto MIXER_FRAMERATE = 30; static constexpr const auto MIXER_FRAMERATE = 30;
static constexpr const auto FRAME_DURATION = std::chrono::duration<double>(1. / MIXER_FRAMERATE); static constexpr const auto FRAME_DURATION = std::chrono::duration<double>(1. / MIXER_FRAMERATE);
VideoMixer::VideoMixer(const std::string& id, const std::string& localInput) VideoMixer::VideoMixer(const std::string& id, const std::string& localInput, bool attachHost)
: VideoGenerator::VideoGenerator() : VideoGenerator::VideoGenerator()
, id_(id) , id_(id)
, sink_(Manager::instance().createSinkClient(id, true)) , sink_(Manager::instance().createSinkClient(id, true))
, loop_([] { return true; }, std::bind(&VideoMixer::process, this), [] {}) , loop_([] { return true; }, std::bind(&VideoMixer::process, this), [] {})
{ {
// Local video camera is the main participant // Local video camera is the main participant
if (not localInput.empty()) { if (not localInput.empty() && attachHost) {
auto videoInput = getVideoInput(localInput); auto videoInput = getVideoInput(localInput);
localInputs_.emplace_back(videoInput); localInputs_.emplace_back(videoInput);
attachVideo(videoInput.get(), attachVideo(videoInput.get(),
...@@ -300,7 +300,7 @@ VideoMixer::process() ...@@ -300,7 +300,7 @@ VideoMixer::process()
int i = 0; int i = 0;
bool activeFound = false; bool activeFound = false;
bool needsUpdate = layoutUpdated_ > 0; bool needsUpdate = layoutUpdated_ > 0;
bool successfullyRendered = false; bool successfullyRendered = audioOnlySources_.size() != 0 && sources_.size() == 0;
std::vector<SourceInfo> sourcesInfo; std::vector<SourceInfo> sourcesInfo;
sourcesInfo.reserve(sources_.size() + audioOnlySources_.size()); sourcesInfo.reserve(sources_.size() + audioOnlySources_.size());
// add all audioonlysources // add all audioonlysources
......
...@@ -37,7 +37,8 @@ namespace video { ...@@ -37,7 +37,8 @@ namespace video {
class SinkClient; class SinkClient;
struct StreamInfo { struct StreamInfo
{
std::string callId; std::string callId;
std::string streamId; std::string streamId;
}; };
...@@ -60,7 +61,7 @@ enum class Layout { GRID, ONE_BIG_WITH_SMALL, ONE_BIG }; ...@@ -60,7 +61,7 @@ enum class Layout { GRID, ONE_BIG_WITH_SMALL, ONE_BIG };
class VideoMixer : public VideoGenerator, public VideoFramePassiveReader class VideoMixer : public VideoGenerator, public VideoFramePassiveReader
{ {
public: public:
VideoMixer(const std::string& id, const std::string& localInput = {}); VideoMixer(const std::string& id, const std::string& localInput = {}, bool attachHost = true);
~VideoMixer(); ~VideoMixer();
void setParameters(int width, int height, AVPixelFormat format = AV_PIX_FMT_YUV422P); void setParameters(int width, int height, AVPixelFormat format = AV_PIX_FMT_YUV422P);
...@@ -93,10 +94,7 @@ public: ...@@ -93,10 +94,7 @@ public:
updateLayout(); updateLayout();
} }
bool verifyActive(const std::string& id) bool verifyActive(const std::string& id) { return activeStream_ == id; }
{
return activeStream_ == id;
}
void setVideoLayout(Layout newLayout) void setVideoLayout(Layout newLayout)
{ {
...@@ -112,7 +110,8 @@ public: ...@@ -112,7 +110,8 @@ public:
MediaStream getStream(const std::string& name) const; MediaStream getStream(const std::string& name) const;
std::shared_ptr<VideoFrameActiveWriter> getVideoLocal() const { std::shared_ptr<VideoFrameActiveWriter> getVideoLocal() const
{
if (!localInputs_.empty()) if (!localInputs_.empty())
return *localInputs_.begin(); return *localInputs_.begin();
return {}; return {};
...@@ -139,7 +138,9 @@ public: ...@@ -139,7 +138,9 @@ public:
} }
} }
void attachVideo(Observable<std::shared_ptr<MediaFrame>>* frame, const std::string& callId, const std::string& streamId); void attachVideo(Observable<std::shared_ptr<MediaFrame>>* frame,
const std::string& callId,
const std::string& streamId);
void detachVideo(Observable<std::shared_ptr<MediaFrame>>* frame); void detachVideo(Observable<std::shared_ptr<MediaFrame>>* frame);
StreamInfo streamInfo(Observable<std::shared_ptr<MediaFrame>>* frame) const StreamInfo streamInfo(Observable<std::shared_ptr<MediaFrame>>* frame) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment