-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "max" option for strategy #1713
Changes from all commits
196794f
86c2ccd
6849e2c
58fe684
acbf53a
9d678f0
bb7607d
e6daca5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ MediaStream::MediaStream(std::shared_ptr<Worker> worker, | |
audio_muted_{false}, video_muted_{false}, | ||
pipeline_initialized_{false}, | ||
is_publisher_{is_publisher}, | ||
target_is_max_video_bw_{false}, | ||
simulcast_{false}, | ||
bitrate_from_max_quality_layer_{0}, | ||
video_bitrate_{0}, | ||
|
@@ -131,6 +132,11 @@ void MediaStream::setMaxVideoBW(uint32_t max_video_bw) { | |
} | ||
}); | ||
} | ||
void MediaStream::cleanPriorityState() { | ||
enableSlideShowBelowSpatialLayer(false, 0); | ||
enableFallbackBelowMinLayer(false); | ||
setTargetIsMaxVideoBW(false); | ||
} | ||
|
||
void MediaStream::setPriority(const std::string& priority) { | ||
boost::mutex::scoped_lock lock(priority_mutex_); | ||
|
@@ -139,8 +145,7 @@ void MediaStream::setPriority(const std::string& priority) { | |
} | ||
ELOG_INFO("%s message: setting Priority to %s", toLog(), priority.c_str()); | ||
priority_ = priority; | ||
enableSlideShowBelowSpatialLayer(false, 0); | ||
enableFallbackBelowMinLayer(false); | ||
cleanPriorityState(); | ||
asyncTask([priority] (std::shared_ptr<MediaStream> media_stream) { | ||
media_stream->stats_->getNode()[media_stream->getVideoSinkSSRC()].insertStat( | ||
"streamPriority", | ||
|
@@ -719,6 +724,14 @@ void MediaStream::setSlideShowMode(bool state) { | |
notifyUpdateToHandlers(); | ||
} | ||
|
||
void MediaStream::setTargetIsMaxVideoBW(bool state) { | ||
ELOG_DEBUG("%s targetIsMaxVideoBw: %u", toLog(), state); | ||
if (target_is_max_video_bw_ == state) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, we are going to be calling this every time the bw estimation algorithm runs. It's true that, in this particular case, it's an atomic and we're not doing anything else like updating stats. As a result, I'm not sure if this is actually an optimization vs updating the value every time. I somewhat like the pattern but I can be convinced to remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I doubt that this optimization worths making the function not threadsafe. |
||
return; | ||
} | ||
target_is_max_video_bw_ = state; | ||
} | ||
|
||
void MediaStream::setTargetPaddingBitrate(uint64_t target_padding_bitrate) { | ||
target_padding_bitrate_ = target_padding_bitrate; | ||
notifyUpdateToHandlers(); | ||
|
@@ -732,6 +745,12 @@ uint32_t MediaStream::getTargetVideoBitrate() { | |
uint32_t bitrate_from_max_quality_layer = getBitrateFromMaxQualityLayer(); | ||
|
||
uint32_t target_bitrate = max_bitrate; | ||
|
||
if (target_is_max_video_bw_) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could max_bitrate be 0 because it has not been initialized? Maybe we should return kInitialBitrate in that case, as we do below. |
||
target_bitrate = target_bitrate == 0? kInitialBitrate: target_bitrate; | ||
return target_bitrate; | ||
} | ||
|
||
if (is_simulcast) { | ||
target_bitrate = std::min(bitrate_from_max_quality_layer, max_bitrate); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a TODO here to remove this new state once we have a connection maximum bandwidth limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we would necessarily have to remove this, I think it adds a different option that is helpful when you have connection maximum bandwidth limit