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

conference: allow rendez-vous without device

Add a parameter to dring.yml file, the video mixer resolution
is set from this parameter (not from videoInput anymore)

Change-Id: I57e2545e8794726a04c093388dee63aeea4b399d
GitLab: #265
parent 747a6368
Branches
No related tags found
No related merge requests found
...@@ -114,6 +114,11 @@ VideoMixer::switchInput(const std::string& input) ...@@ -114,6 +114,11 @@ VideoMixer::switchInput(const std::string& input)
videoLocal_ = getVideoCamera(); videoLocal_ = getVideoCamera();
} }
if (input.empty()) {
JAMI_DBG("Input is empty, don't add it in the mixer");
return;
}
// Re-attach videoInput to mixer // Re-attach videoInput to mixer
if (videoLocal_) { if (videoLocal_) {
if (auto localInput = std::dynamic_pointer_cast<VideoInput>(videoLocal_)) { if (auto localInput = std::dynamic_pointer_cast<VideoInput>(videoLocal_)) {
......
...@@ -145,8 +145,17 @@ VideoRtpSession::startSender() ...@@ -145,8 +145,17 @@ VideoRtpSession::startSender()
try { try {
sender_.reset(); sender_.reset();
socketPair_->stopSendOp(false); socketPair_->stopSendOp(false);
MediaStream ms = !conference_ ?
MediaStream("video sender",
AV_PIX_FMT_YUV420P,
1 / static_cast<rational<int>>(localVideoParams_.framerate),
localVideoParams_.width,
localVideoParams_.height,
send_.bitrate,
static_cast<rational<int>>(localVideoParams_.framerate)) :
conference_->getVideoMixer()->getStream("Video Sender");
sender_.reset(new VideoSender(getRemoteRtpUri(), sender_.reset(new VideoSender(getRemoteRtpUri(),
localVideoParams_, ms,
send_, send_,
*socketPair_, *socketPair_,
initSeqVal_ + 1, initSeqVal_ + 1,
...@@ -340,12 +349,17 @@ VideoRtpSession::enterConference(Conference* conference) ...@@ -340,12 +349,17 @@ VideoRtpSession::enterConference(Conference* conference)
// TODO is this correct? The video Mixer should be enabled for a detached conference even if we // TODO is this correct? The video Mixer should be enabled for a detached conference even if we
// are not sending values // are not sending values
videoMixer_ = conference->getVideoMixer(); videoMixer_ = conference->getVideoMixer();
auto conf_res = split_string_to_unsigned(jami::Manager::instance().videoPreferences.getConferenceResolution(), 'x');
if (conf_res.size() != 2 or conf_res[0] <= 0 or conf_res[1] <= 0) {
JAMI_ERR("Conference resolution is invalid");
return;
}
#if defined(__APPLE__) && TARGET_OS_MAC #if defined(__APPLE__) && TARGET_OS_MAC
videoMixer_->setParameters(localVideoParams_.width, videoMixer_->setParameters(conf_res[0],
localVideoParams_.height, conf_res[1],
av_get_pix_fmt(localVideoParams_.pixel_format.c_str())); AV_PIX_FMT_NV12);
#else #else
videoMixer_->setParameters(localVideoParams_.width, localVideoParams_.height); videoMixer_->setParameters(conf_res[0], conf_res[1]);
#endif #endif
if (send_.enabled or receiveThread_) { if (send_.enabled or receiveThread_) {
setupConferenceVideoPipeline(*conference_); setupConferenceVideoPipeline(*conference_);
......
...@@ -43,7 +43,7 @@ namespace video { ...@@ -43,7 +43,7 @@ namespace video {
using std::string; using std::string;
VideoSender::VideoSender(const std::string& dest, VideoSender::VideoSender(const std::string& dest,
const DeviceParams& dev, const MediaStream& opts,
const MediaDescription& args, const MediaDescription& args,
SocketPair& socketPair, SocketPair& socketPair,
const uint16_t seqVal, const uint16_t seqVal,
...@@ -51,15 +51,8 @@ VideoSender::VideoSender(const std::string& dest, ...@@ -51,15 +51,8 @@ VideoSender::VideoSender(const std::string& dest,
: muxContext_(socketPair.createIOContext(mtu)) : muxContext_(socketPair.createIOContext(mtu))
, videoEncoder_(new MediaEncoder) , videoEncoder_(new MediaEncoder)
{ {
keyFrameFreq_ = dev.framerate.numerator() * KEY_FRAME_PERIOD; keyFrameFreq_ = opts.frameRate.numerator() * KEY_FRAME_PERIOD;
videoEncoder_->openOutput(dest, "rtp"); videoEncoder_->openOutput(dest, "rtp");
auto opts = MediaStream("video sender",
AV_PIX_FMT_YUV420P,
1 / (rational<int>) dev.framerate,
dev.width,
dev.height,
args.bitrate,
(rational<int>) dev.framerate);
videoEncoder_->setOptions(opts); videoEncoder_->setOptions(opts);
videoEncoder_->setOptions(args); videoEncoder_->setOptions(args);
videoEncoder_->addStream(args.codec->systemCodecInfo); videoEncoder_->addStream(args.codec->systemCodecInfo);
...@@ -70,7 +63,7 @@ VideoSender::VideoSender(const std::string& dest, ...@@ -70,7 +63,7 @@ VideoSender::VideoSender(const std::string& dest,
Smartools::getInstance().setLocalVideoCodec(videoEncoder_->getVideoCodec()); Smartools::getInstance().setLocalVideoCodec(videoEncoder_->getVideoCodec());
// Send the resolution in smartInfo // Send the resolution in smartInfo
Smartools::getInstance().setResolution("local", dev.width, dev.height); Smartools::getInstance().setResolution("local", opts.width, opts.height);
} }
VideoSender::~VideoSender() VideoSender::~VideoSender()
......
...@@ -44,7 +44,7 @@ class VideoSender : public VideoFramePassiveReader ...@@ -44,7 +44,7 @@ class VideoSender : public VideoFramePassiveReader
{ {
public: public:
VideoSender(const std::string& dest, VideoSender(const std::string& dest,
const DeviceParams& dev, const MediaStream& opts,
const MediaDescription& args, const MediaDescription& args,
SocketPair& socketPair, SocketPair& socketPair,
const uint16_t seqVal, const uint16_t seqVal,
......
...@@ -78,6 +78,7 @@ using yaml_utils::parseValue; ...@@ -78,6 +78,7 @@ using yaml_utils::parseValue;
constexpr const char* const Preferences::CONFIG_LABEL; constexpr const char* const Preferences::CONFIG_LABEL;
const char* const Preferences::DFT_ZONE = "North America"; const char* const Preferences::DFT_ZONE = "North America";
const char* const Preferences::REGISTRATION_EXPIRE_KEY = "registrationexpire"; const char* const Preferences::REGISTRATION_EXPIRE_KEY = "registrationexpire";
constexpr std::string_view DEFAULT_CONFERENCE_RESOLUTION {"1280x720"};
// general preferences // general preferences
static constexpr const char* ORDER_KEY {"order"}; static constexpr const char* ORDER_KEY {"order"};
...@@ -136,6 +137,7 @@ static constexpr const char* DECODING_ACCELERATED_KEY {"decodingAccelerated"}; ...@@ -136,6 +137,7 @@ static constexpr const char* DECODING_ACCELERATED_KEY {"decodingAccelerated"};
static constexpr const char* ENCODING_ACCELERATED_KEY {"encodingAccelerated"}; static constexpr const char* ENCODING_ACCELERATED_KEY {"encodingAccelerated"};
static constexpr const char* RECORD_PREVIEW_KEY {"recordPreview"}; static constexpr const char* RECORD_PREVIEW_KEY {"recordPreview"};
static constexpr const char* RECORD_QUALITY_KEY {"recordQuality"}; static constexpr const char* RECORD_QUALITY_KEY {"recordQuality"};
static constexpr const char* CONFERENCE_RESOLUTION_KEY {"conferenceResolution"};
#endif #endif
#ifdef ENABLE_PLUGIN #ifdef ENABLE_PLUGIN
...@@ -561,6 +563,7 @@ VideoPreferences::VideoPreferences() ...@@ -561,6 +563,7 @@ VideoPreferences::VideoPreferences()
, encodingAccelerated_(false) , encodingAccelerated_(false)
, recordPreview_(true) , recordPreview_(true)
, recordQuality_(0) , recordQuality_(0)
, conferenceResolution_(DEFAULT_CONFERENCE_RESOLUTION)
{} {}
void void
...@@ -573,6 +576,7 @@ VideoPreferences::serialize(YAML::Emitter& out) const ...@@ -573,6 +576,7 @@ VideoPreferences::serialize(YAML::Emitter& out) const
out << YAML::Key << DECODING_ACCELERATED_KEY << YAML::Value << decodingAccelerated_; out << YAML::Key << DECODING_ACCELERATED_KEY << YAML::Value << decodingAccelerated_;
out << YAML::Key << ENCODING_ACCELERATED_KEY << YAML::Value << encodingAccelerated_; out << YAML::Key << ENCODING_ACCELERATED_KEY << YAML::Value << encodingAccelerated_;
#endif #endif
out << YAML::Key << CONFERENCE_RESOLUTION_KEY << YAML::Value << conferenceResolution_;
getVideoDeviceMonitor().serialize(out); getVideoDeviceMonitor().serialize(out);
out << YAML::EndMap; out << YAML::EndMap;
} }
...@@ -598,6 +602,11 @@ VideoPreferences::unserialize(const YAML::Node& in) ...@@ -598,6 +602,11 @@ VideoPreferences::unserialize(const YAML::Node& in)
encodingAccelerated_ = false; encodingAccelerated_ = false;
} }
#endif #endif
try {
parseValue(node, CONFERENCE_RESOLUTION_KEY, conferenceResolution_);
} catch (...) {
conferenceResolution_ = DEFAULT_CONFERENCE_RESOLUTION;
}
getVideoDeviceMonitor().unserialize(in); getVideoDeviceMonitor().unserialize(in);
} }
#endif // ENABLE_VIDEO #endif // ENABLE_VIDEO
......
...@@ -339,11 +339,16 @@ public: ...@@ -339,11 +339,16 @@ public:
void setRecordQuality(int rec) { recordQuality_ = rec; } void setRecordQuality(int rec) { recordQuality_ = rec; }
const std::string& getConferenceResolution() const { return conferenceResolution_; }
void setConferenceResolution(const std::string& res) { conferenceResolution_ = res; }
private: private:
bool decodingAccelerated_; bool decodingAccelerated_;
bool encodingAccelerated_; bool encodingAccelerated_;
bool recordPreview_; bool recordPreview_;
int recordQuality_; int recordQuality_;
std::string conferenceResolution_;
constexpr static const char* const CONFIG_LABEL = "video"; constexpr static const char* const CONFIG_LABEL = "video";
}; };
#endif // ENABLE_VIDEO #endif // ENABLE_VIDEO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment