Small refactor on ViE to remove redudant conditions and long ifdefs.
BUG=3694 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/22069004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6905 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -608,9 +608,7 @@ bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
|
|||||||
int ModuleRtpRtcpImpl::TimeToSendPadding(int bytes) {
|
int ModuleRtpRtcpImpl::TimeToSendPadding(int bytes) {
|
||||||
if (!IsDefaultModule()) {
|
if (!IsDefaultModule()) {
|
||||||
// Don't send from default module.
|
// Don't send from default module.
|
||||||
if (SendingMedia()) {
|
return rtp_sender_.TimeToSendPadding(bytes);
|
||||||
return rtp_sender_.TimeToSendPadding(bytes);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||||
for (size_t i = 0; i < child_modules_.size(); ++i) {
|
for (size_t i = 0; i < child_modules_.size(); ++i) {
|
||||||
|
|||||||
@ -238,7 +238,7 @@ public:
|
|||||||
// frame rate/dimensions need to be updated for video quality optimization
|
// frame rate/dimensions need to be updated for video quality optimization
|
||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - videoQMSettings : The callback object to register.
|
// - videoQMSettings : The callback object to register.
|
||||||
//
|
//
|
||||||
// Return value : VCM_OK, on success.
|
// Return value : VCM_OK, on success.
|
||||||
// < 0, on error
|
// < 0, on error
|
||||||
|
|||||||
@ -187,8 +187,13 @@ bool ViEEncoder::Init() {
|
|||||||
qm_callback_ = new QMVideoSettingsCallback(&vpm_);
|
qm_callback_ = new QMVideoSettingsCallback(&vpm_);
|
||||||
|
|
||||||
#ifdef VIDEOCODEC_VP8
|
#ifdef VIDEOCODEC_VP8
|
||||||
|
VideoCodecType codec_type = webrtc::kVideoCodecVP8;
|
||||||
|
#else
|
||||||
|
VideoCodecType codec_type = webrtc::kVideoCodecI420;
|
||||||
|
#endif
|
||||||
|
|
||||||
VideoCodec video_codec;
|
VideoCodec video_codec;
|
||||||
if (vcm_.Codec(webrtc::kVideoCodecVP8, &video_codec) != VCM_OK) {
|
if (vcm_.Codec(codec_type, &video_codec) != VCM_OK) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -202,21 +207,6 @@ bool ViEEncoder::Init() {
|
|||||||
if (default_rtp_rtcp_->RegisterSendPayload(video_codec) != 0) {
|
if (default_rtp_rtcp_->RegisterSendPayload(video_codec) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
VideoCodec video_codec;
|
|
||||||
if (vcm_.Codec(webrtc::kVideoCodecI420, &video_codec) == VCM_OK) {
|
|
||||||
{
|
|
||||||
CriticalSectionScoped cs(data_cs_.get());
|
|
||||||
send_padding_ = video_codec.numberOfSimulcastStreams > 1;
|
|
||||||
}
|
|
||||||
vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
|
|
||||||
default_rtp_rtcp_->MaxDataPayloadLength());
|
|
||||||
default_rtp_rtcp_->RegisterSendPayload(video_codec);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (vcm_.RegisterTransportCallback(this) != 0) {
|
if (vcm_.RegisterTransportCallback(this) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -362,11 +352,10 @@ int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) {
|
|||||||
|
|
||||||
// Set this module as sending right away, let the slave module in the channel
|
// Set this module as sending right away, let the slave module in the channel
|
||||||
// start and stop sending.
|
// start and stop sending.
|
||||||
if (default_rtp_rtcp_->Sending() == false) {
|
if (default_rtp_rtcp_->SetSendingStatus(true) != 0) {
|
||||||
if (default_rtp_rtcp_->SetSendingStatus(true) != 0) {
|
return -1;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bitrate_controller_->SetBitrateObserver(bitrate_observer_.get(),
|
bitrate_controller_->SetBitrateObserver(bitrate_observer_.get(),
|
||||||
video_codec.startBitrate * 1000,
|
video_codec.startBitrate * 1000,
|
||||||
video_codec.minBitrate * 1000,
|
video_codec.minBitrate * 1000,
|
||||||
|
|||||||
Reference in New Issue
Block a user