mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
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
This commit is contained in:
@ -114,6 +114,11 @@ VideoMixer::switchInput(const std::string& input)
|
||||
videoLocal_ = getVideoCamera();
|
||||
}
|
||||
|
||||
if (input.empty()) {
|
||||
JAMI_DBG("Input is empty, don't add it in the mixer");
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-attach videoInput to mixer
|
||||
if (videoLocal_) {
|
||||
if (auto localInput = std::dynamic_pointer_cast<VideoInput>(videoLocal_)) {
|
||||
|
@ -145,12 +145,21 @@ VideoRtpSession::startSender()
|
||||
try {
|
||||
sender_.reset();
|
||||
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(),
|
||||
localVideoParams_,
|
||||
send_,
|
||||
*socketPair_,
|
||||
initSeqVal_ + 1,
|
||||
mtu_));
|
||||
ms,
|
||||
send_,
|
||||
*socketPair_,
|
||||
initSeqVal_ + 1,
|
||||
mtu_));
|
||||
if (changeOrientationCallback_)
|
||||
sender_->setChangeOrientationCallback(changeOrientationCallback_);
|
||||
if (socketPair_)
|
||||
@ -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
|
||||
// are not sending values
|
||||
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
|
||||
videoMixer_->setParameters(localVideoParams_.width,
|
||||
localVideoParams_.height,
|
||||
av_get_pix_fmt(localVideoParams_.pixel_format.c_str()));
|
||||
videoMixer_->setParameters(conf_res[0],
|
||||
conf_res[1],
|
||||
AV_PIX_FMT_NV12);
|
||||
#else
|
||||
videoMixer_->setParameters(localVideoParams_.width, localVideoParams_.height);
|
||||
videoMixer_->setParameters(conf_res[0], conf_res[1]);
|
||||
#endif
|
||||
if (send_.enabled or receiveThread_) {
|
||||
setupConferenceVideoPipeline(*conference_);
|
||||
|
@ -43,7 +43,7 @@ namespace video {
|
||||
using std::string;
|
||||
|
||||
VideoSender::VideoSender(const std::string& dest,
|
||||
const DeviceParams& dev,
|
||||
const MediaStream& opts,
|
||||
const MediaDescription& args,
|
||||
SocketPair& socketPair,
|
||||
const uint16_t seqVal,
|
||||
@ -51,15 +51,8 @@ VideoSender::VideoSender(const std::string& dest,
|
||||
: muxContext_(socketPair.createIOContext(mtu))
|
||||
, videoEncoder_(new MediaEncoder)
|
||||
{
|
||||
keyFrameFreq_ = dev.framerate.numerator() * KEY_FRAME_PERIOD;
|
||||
keyFrameFreq_ = opts.frameRate.numerator() * KEY_FRAME_PERIOD;
|
||||
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(args);
|
||||
videoEncoder_->addStream(args.codec->systemCodecInfo);
|
||||
@ -70,7 +63,7 @@ VideoSender::VideoSender(const std::string& dest,
|
||||
Smartools::getInstance().setLocalVideoCodec(videoEncoder_->getVideoCodec());
|
||||
|
||||
// Send the resolution in smartInfo
|
||||
Smartools::getInstance().setResolution("local", dev.width, dev.height);
|
||||
Smartools::getInstance().setResolution("local", opts.width, opts.height);
|
||||
}
|
||||
|
||||
VideoSender::~VideoSender()
|
||||
|
@ -44,7 +44,7 @@ class VideoSender : public VideoFramePassiveReader
|
||||
{
|
||||
public:
|
||||
VideoSender(const std::string& dest,
|
||||
const DeviceParams& dev,
|
||||
const MediaStream& opts,
|
||||
const MediaDescription& args,
|
||||
SocketPair& socketPair,
|
||||
const uint16_t seqVal,
|
||||
|
@ -78,6 +78,7 @@ using yaml_utils::parseValue;
|
||||
constexpr const char* const Preferences::CONFIG_LABEL;
|
||||
const char* const Preferences::DFT_ZONE = "North America";
|
||||
const char* const Preferences::REGISTRATION_EXPIRE_KEY = "registrationexpire";
|
||||
constexpr std::string_view DEFAULT_CONFERENCE_RESOLUTION {"1280x720"};
|
||||
|
||||
// general preferences
|
||||
static constexpr const char* ORDER_KEY {"order"};
|
||||
@ -136,6 +137,7 @@ static constexpr const char* DECODING_ACCELERATED_KEY {"decodingAccelerated"};
|
||||
static constexpr const char* ENCODING_ACCELERATED_KEY {"encodingAccelerated"};
|
||||
static constexpr const char* RECORD_PREVIEW_KEY {"recordPreview"};
|
||||
static constexpr const char* RECORD_QUALITY_KEY {"recordQuality"};
|
||||
static constexpr const char* CONFERENCE_RESOLUTION_KEY {"conferenceResolution"};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PLUGIN
|
||||
@ -561,6 +563,7 @@ VideoPreferences::VideoPreferences()
|
||||
, encodingAccelerated_(false)
|
||||
, recordPreview_(true)
|
||||
, recordQuality_(0)
|
||||
, conferenceResolution_(DEFAULT_CONFERENCE_RESOLUTION)
|
||||
{}
|
||||
|
||||
void
|
||||
@ -573,6 +576,7 @@ VideoPreferences::serialize(YAML::Emitter& out) const
|
||||
out << YAML::Key << DECODING_ACCELERATED_KEY << YAML::Value << decodingAccelerated_;
|
||||
out << YAML::Key << ENCODING_ACCELERATED_KEY << YAML::Value << encodingAccelerated_;
|
||||
#endif
|
||||
out << YAML::Key << CONFERENCE_RESOLUTION_KEY << YAML::Value << conferenceResolution_;
|
||||
getVideoDeviceMonitor().serialize(out);
|
||||
out << YAML::EndMap;
|
||||
}
|
||||
@ -598,6 +602,11 @@ VideoPreferences::unserialize(const YAML::Node& in)
|
||||
encodingAccelerated_ = false;
|
||||
}
|
||||
#endif
|
||||
try {
|
||||
parseValue(node, CONFERENCE_RESOLUTION_KEY, conferenceResolution_);
|
||||
} catch (...) {
|
||||
conferenceResolution_ = DEFAULT_CONFERENCE_RESOLUTION;
|
||||
}
|
||||
getVideoDeviceMonitor().unserialize(in);
|
||||
}
|
||||
#endif // ENABLE_VIDEO
|
||||
|
@ -339,11 +339,16 @@ public:
|
||||
|
||||
void setRecordQuality(int rec) { recordQuality_ = rec; }
|
||||
|
||||
const std::string& getConferenceResolution() const { return conferenceResolution_; }
|
||||
|
||||
void setConferenceResolution(const std::string& res) { conferenceResolution_ = res; }
|
||||
|
||||
private:
|
||||
bool decodingAccelerated_;
|
||||
bool encodingAccelerated_;
|
||||
bool recordPreview_;
|
||||
int recordQuality_;
|
||||
std::string conferenceResolution_;
|
||||
constexpr static const char* const CONFIG_LABEL = "video";
|
||||
};
|
||||
#endif // ENABLE_VIDEO
|
||||
|
Reference in New Issue
Block a user