Remove unused members in MediaOptimization.
BUG=none Review-Url: https://codereview.webrtc.org/2993703002 Cr-Commit-Position: refs/heads/master@{#19252}
This commit is contained in:
@ -37,18 +37,12 @@ struct MediaOptimization::EncodedFrameSample {
|
|||||||
MediaOptimization::MediaOptimization(Clock* clock)
|
MediaOptimization::MediaOptimization(Clock* clock)
|
||||||
: clock_(clock),
|
: clock_(clock),
|
||||||
max_bit_rate_(0),
|
max_bit_rate_(0),
|
||||||
codec_width_(0),
|
|
||||||
codec_height_(0),
|
|
||||||
user_frame_rate_(0),
|
user_frame_rate_(0),
|
||||||
frame_dropper_(new FrameDropper),
|
frame_dropper_(new FrameDropper),
|
||||||
send_statistics_zero_encode_(0),
|
|
||||||
max_payload_size_(1460),
|
|
||||||
video_target_bitrate_(0),
|
video_target_bitrate_(0),
|
||||||
incoming_frame_rate_(0),
|
incoming_frame_rate_(0),
|
||||||
encoded_frame_samples_(),
|
encoded_frame_samples_(),
|
||||||
avg_sent_framerate_(0),
|
avg_sent_framerate_(0) {
|
||||||
num_layers_(0) {
|
|
||||||
memset(send_statistics_, 0, sizeof(send_statistics_));
|
|
||||||
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,52 +51,34 @@ MediaOptimization::~MediaOptimization(void) {
|
|||||||
|
|
||||||
void MediaOptimization::Reset() {
|
void MediaOptimization::Reset() {
|
||||||
rtc::CritScope lock(&crit_sect_);
|
rtc::CritScope lock(&crit_sect_);
|
||||||
SetEncodingDataInternal(0, 0, 0, 0, 0, 0, max_payload_size_);
|
SetEncodingDataInternal(0, 0, 0);
|
||||||
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
||||||
incoming_frame_rate_ = 0.0;
|
incoming_frame_rate_ = 0.0;
|
||||||
frame_dropper_->Reset();
|
frame_dropper_->Reset();
|
||||||
frame_dropper_->SetRates(0, 0);
|
frame_dropper_->SetRates(0, 0);
|
||||||
send_statistics_zero_encode_ = 0;
|
|
||||||
video_target_bitrate_ = 0;
|
video_target_bitrate_ = 0;
|
||||||
codec_width_ = 0;
|
|
||||||
codec_height_ = 0;
|
|
||||||
user_frame_rate_ = 0;
|
user_frame_rate_ = 0;
|
||||||
encoded_frame_samples_.clear();
|
encoded_frame_samples_.clear();
|
||||||
num_layers_ = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaOptimization::SetEncodingData(int32_t max_bit_rate,
|
void MediaOptimization::SetEncodingData(int32_t max_bit_rate,
|
||||||
uint32_t target_bitrate,
|
uint32_t target_bitrate,
|
||||||
uint16_t width,
|
uint32_t frame_rate) {
|
||||||
uint16_t height,
|
|
||||||
uint32_t frame_rate,
|
|
||||||
int num_layers,
|
|
||||||
int32_t mtu) {
|
|
||||||
rtc::CritScope lock(&crit_sect_);
|
rtc::CritScope lock(&crit_sect_);
|
||||||
SetEncodingDataInternal(max_bit_rate, frame_rate, target_bitrate, width,
|
SetEncodingDataInternal(max_bit_rate, frame_rate, target_bitrate);
|
||||||
height, num_layers, mtu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaOptimization::SetEncodingDataInternal(int32_t max_bit_rate,
|
void MediaOptimization::SetEncodingDataInternal(int32_t max_bit_rate,
|
||||||
uint32_t frame_rate,
|
uint32_t frame_rate,
|
||||||
uint32_t target_bitrate,
|
uint32_t target_bitrate) {
|
||||||
uint16_t width,
|
|
||||||
uint16_t height,
|
|
||||||
int num_layers,
|
|
||||||
int32_t mtu) {
|
|
||||||
// Everything codec specific should be reset here since this means the codec
|
// Everything codec specific should be reset here since this means the codec
|
||||||
// has changed.
|
// has changed.
|
||||||
|
|
||||||
max_bit_rate_ = max_bit_rate;
|
max_bit_rate_ = max_bit_rate;
|
||||||
video_target_bitrate_ = target_bitrate;
|
video_target_bitrate_ = target_bitrate;
|
||||||
float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
|
float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
|
||||||
frame_dropper_->Reset();
|
frame_dropper_->Reset();
|
||||||
frame_dropper_->SetRates(target_bitrate_kbps, static_cast<float>(frame_rate));
|
frame_dropper_->SetRates(target_bitrate_kbps, static_cast<float>(frame_rate));
|
||||||
user_frame_rate_ = static_cast<float>(frame_rate);
|
user_frame_rate_ = static_cast<float>(frame_rate);
|
||||||
codec_width_ = width;
|
|
||||||
codec_height_ = height;
|
|
||||||
num_layers_ = (num_layers <= 1) ? 1 : num_layers; // Can also be zero.
|
|
||||||
max_payload_size_ = mtu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate) {
|
uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate) {
|
||||||
@ -247,7 +223,7 @@ void MediaOptimization::ProcessIncomingFrameRate(int64_t now) {
|
|||||||
int32_t nr_of_frames = 0;
|
int32_t nr_of_frames = 0;
|
||||||
for (num = 1; num < (kFrameCountHistorySize - 1); ++num) {
|
for (num = 1; num < (kFrameCountHistorySize - 1); ++num) {
|
||||||
if (incoming_frame_times_[num] <= 0 ||
|
if (incoming_frame_times_[num] <= 0 ||
|
||||||
// don't use data older than 2 s
|
// Don't use data older than 2 s.
|
||||||
now - incoming_frame_times_[num] > kFrameHistoryWinMs) {
|
now - incoming_frame_times_[num] > kFrameHistoryWinMs) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// Forward declarations.
|
|
||||||
class Clock;
|
class Clock;
|
||||||
class FrameDropper;
|
class FrameDropper;
|
||||||
class VCMContentMetricsProcessing;
|
class VCMContentMetricsProcessing;
|
||||||
@ -42,14 +41,10 @@ class MediaOptimization {
|
|||||||
// VieEncoder.
|
// VieEncoder.
|
||||||
void SetEncodingData(int32_t max_bit_rate,
|
void SetEncodingData(int32_t max_bit_rate,
|
||||||
uint32_t bit_rate,
|
uint32_t bit_rate,
|
||||||
uint16_t width,
|
uint32_t frame_rate);
|
||||||
uint16_t height,
|
|
||||||
uint32_t frame_rate,
|
|
||||||
int num_temporal_layers,
|
|
||||||
int32_t mtu);
|
|
||||||
|
|
||||||
// Sets target rates for the encoder given the channel parameters.
|
// Sets target rates for the encoder given the channel parameters.
|
||||||
// Input: target bitrate - the encoder target bitrate in bits/s.
|
// Input: |target bitrate| - the encoder target bitrate in bits/s.
|
||||||
uint32_t SetTargetRates(uint32_t target_bitrate);
|
uint32_t SetTargetRates(uint32_t target_bitrate);
|
||||||
|
|
||||||
void EnableFrameDropper(bool enable);
|
void EnableFrameDropper(bool enable);
|
||||||
@ -76,8 +71,6 @@ class MediaOptimization {
|
|||||||
void UpdateIncomingFrameRate() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
void UpdateIncomingFrameRate() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||||
void PurgeOldFrameSamples(int64_t threshold_ms)
|
void PurgeOldFrameSamples(int64_t threshold_ms)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||||
// Updates the sent bitrate field, a call to PurgeOldFrameSamples must preceed
|
|
||||||
int GetSentBitrate(int64_t now_ms) EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
|
||||||
void UpdateSentFramerate() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
void UpdateSentFramerate() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||||
|
|
||||||
void ProcessIncomingFrameRate(int64_t now)
|
void ProcessIncomingFrameRate(int64_t now)
|
||||||
@ -90,11 +83,7 @@ class MediaOptimization {
|
|||||||
|
|
||||||
void SetEncodingDataInternal(int32_t max_bit_rate,
|
void SetEncodingDataInternal(int32_t max_bit_rate,
|
||||||
uint32_t frame_rate,
|
uint32_t frame_rate,
|
||||||
uint32_t bit_rate,
|
uint32_t bit_rate)
|
||||||
uint16_t width,
|
|
||||||
uint16_t height,
|
|
||||||
int num_temporal_layers,
|
|
||||||
int32_t mtu)
|
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||||
|
|
||||||
uint32_t InputFrameRateInternal() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
uint32_t InputFrameRateInternal() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||||
@ -106,19 +95,13 @@ class MediaOptimization {
|
|||||||
|
|
||||||
Clock* clock_ GUARDED_BY(crit_sect_);
|
Clock* clock_ GUARDED_BY(crit_sect_);
|
||||||
int32_t max_bit_rate_ GUARDED_BY(crit_sect_);
|
int32_t max_bit_rate_ GUARDED_BY(crit_sect_);
|
||||||
uint16_t codec_width_ GUARDED_BY(crit_sect_);
|
|
||||||
uint16_t codec_height_ GUARDED_BY(crit_sect_);
|
|
||||||
float user_frame_rate_ GUARDED_BY(crit_sect_);
|
float user_frame_rate_ GUARDED_BY(crit_sect_);
|
||||||
std::unique_ptr<FrameDropper> frame_dropper_ GUARDED_BY(crit_sect_);
|
std::unique_ptr<FrameDropper> frame_dropper_ GUARDED_BY(crit_sect_);
|
||||||
uint32_t send_statistics_[4] GUARDED_BY(crit_sect_);
|
|
||||||
uint32_t send_statistics_zero_encode_ GUARDED_BY(crit_sect_);
|
|
||||||
int32_t max_payload_size_ GUARDED_BY(crit_sect_);
|
|
||||||
int video_target_bitrate_ GUARDED_BY(crit_sect_);
|
int video_target_bitrate_ GUARDED_BY(crit_sect_);
|
||||||
float incoming_frame_rate_ GUARDED_BY(crit_sect_);
|
float incoming_frame_rate_ GUARDED_BY(crit_sect_);
|
||||||
int64_t incoming_frame_times_[kFrameCountHistorySize] GUARDED_BY(crit_sect_);
|
int64_t incoming_frame_times_[kFrameCountHistorySize] GUARDED_BY(crit_sect_);
|
||||||
std::list<EncodedFrameSample> encoded_frame_samples_ GUARDED_BY(crit_sect_);
|
std::list<EncodedFrameSample> encoded_frame_samples_ GUARDED_BY(crit_sect_);
|
||||||
uint32_t avg_sent_framerate_ GUARDED_BY(crit_sect_);
|
uint32_t avg_sent_framerate_ GUARDED_BY(crit_sect_);
|
||||||
int num_layers_ GUARDED_BY(crit_sect_);
|
|
||||||
};
|
};
|
||||||
} // namespace media_optimization
|
} // namespace media_optimization
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -136,9 +136,8 @@ int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec,
|
|||||||
<< " max frame rate " << sendCodec->maxFramerate
|
<< " max frame rate " << sendCodec->maxFramerate
|
||||||
<< " max payload size " << maxPayloadSize;
|
<< " max payload size " << maxPayloadSize;
|
||||||
_mediaOpt.SetEncodingData(sendCodec->maxBitrate * 1000,
|
_mediaOpt.SetEncodingData(sendCodec->maxBitrate * 1000,
|
||||||
sendCodec->startBitrate * 1000, sendCodec->width,
|
sendCodec->startBitrate * 1000,
|
||||||
sendCodec->height, sendCodec->maxFramerate,
|
sendCodec->maxFramerate);
|
||||||
numLayers, maxPayloadSize);
|
|
||||||
return VCM_OK;
|
return VCM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user