зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1338086 - Remove useless else blocks in order to reduce complexity in media/webrtc/signaling/ r=jesup
MozReview-Commit-ID: EU5B0cUYp6c --HG-- extra : rebase_source : 82aa967f8abfceb785ef7392b915c992ebc5d9a0
This commit is contained in:
Родитель
9a3ff09f1a
Коммит
d0d9f70792
|
@ -2496,11 +2496,8 @@ JsepSessionImpl::GetParsedLocalDescription() const
|
|||
{
|
||||
if (mPendingLocalDescription) {
|
||||
return mPendingLocalDescription.get();
|
||||
} else if (mCurrentLocalDescription) {
|
||||
return mCurrentLocalDescription.get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return mCurrentLocalDescription.get();
|
||||
}
|
||||
|
||||
mozilla::Sdp*
|
||||
|
@ -2508,11 +2505,8 @@ JsepSessionImpl::GetParsedRemoteDescription() const
|
|||
{
|
||||
if (mPendingRemoteDescription) {
|
||||
return mPendingRemoteDescription.get();
|
||||
} else if (mCurrentRemoteDescription) {
|
||||
return mCurrentRemoteDescription.get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return mCurrentRemoteDescription.get();
|
||||
}
|
||||
|
||||
const Sdp*
|
||||
|
|
|
@ -536,19 +536,16 @@ WebrtcAudioConduit::ConfigureRecvMediaCodecs(
|
|||
error = mPtrVoEBase->LastError();
|
||||
CSFLogError(logTag, "%s SetRecvCodec Failed %d ",__FUNCTION__, error);
|
||||
continue;
|
||||
} else {
|
||||
CSFLogDebug(logTag, "%s Successfully Set RecvCodec %s", __FUNCTION__,
|
||||
codec->mName.c_str());
|
||||
//copy this to local database
|
||||
if(CopyCodecToDB(codec))
|
||||
{
|
||||
success = true;
|
||||
} else {
|
||||
}
|
||||
CSFLogDebug(logTag, "%s Successfully Set RecvCodec %s", __FUNCTION__,
|
||||
codec->mName.c_str());
|
||||
|
||||
//copy this to local database
|
||||
if(!CopyCodecToDB(codec)) {
|
||||
CSFLogError(logTag,"%s Unable to updated Codec Database", __FUNCTION__);
|
||||
return kMediaConduitUnknownError;
|
||||
}
|
||||
|
||||
}
|
||||
success = true;
|
||||
|
||||
} //end for
|
||||
|
||||
|
@ -927,23 +924,22 @@ WebrtcAudioConduit::SendRtp(const uint8_t* data,
|
|||
// with the Call API update in the webrtc.org codebase.
|
||||
// The only field in it is the packet_id, which is used when the header
|
||||
// extension for TransportSequenceNumber is being used, which we don't.
|
||||
(void) options;
|
||||
(void)options;
|
||||
if(mTransmitterTransport &&
|
||||
(mTransmitterTransport->SendRtpPacket(data, len) == NS_OK))
|
||||
{
|
||||
CSFLogDebug(logTag, "%s Sent RTP Packet ", __FUNCTION__);
|
||||
return true;
|
||||
} else {
|
||||
CSFLogError(logTag, "%s RTP Packet Send Failed ", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
CSFLogError(logTag, "%s RTP Packet Send Failed ", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called on WebRTC Process thread and perhaps others
|
||||
bool
|
||||
WebrtcAudioConduit::SendRtcp(const uint8_t* data, size_t len)
|
||||
{
|
||||
CSFLogDebug(logTag, "%s : len %lu, first rtcp = %u ",
|
||||
CSFLogDebug(logTag, "%s : len %lu, first rtcp = %u ",
|
||||
__FUNCTION__,
|
||||
(unsigned long) len,
|
||||
static_cast<unsigned>(data[1]));
|
||||
|
@ -958,14 +954,14 @@ WebrtcAudioConduit::SendRtcp(const uint8_t* data, size_t len)
|
|||
// Might be a sender report, might be a receiver report, we don't know.
|
||||
CSFLogDebug(logTag, "%s Sent RTCP Packet ", __FUNCTION__);
|
||||
return true;
|
||||
} else if(mTransmitterTransport &&
|
||||
(mTransmitterTransport->SendRtcpPacket(data, len) == NS_OK)) {
|
||||
CSFLogDebug(logTag, "%s Sent RTCP Packet (sender report) ", __FUNCTION__);
|
||||
return true;
|
||||
} else {
|
||||
CSFLogError(logTag, "%s RTCP Packet Send Failed ", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
if (mTransmitterTransport &&
|
||||
(mTransmitterTransport->SendRtcpPacket(data, len) == NS_OK)) {
|
||||
CSFLogDebug(logTag, "%s Sent RTCP Packet (sender report) ", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
CSFLogError(logTag, "%s RTCP Packet Send Failed ", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -975,7 +971,7 @@ WebrtcAudioConduit::SendRtcp(const uint8_t* data, size_t len)
|
|||
bool
|
||||
WebrtcAudioConduit::CodecConfigToWebRTCCodec(const AudioCodecConfig* codecInfo,
|
||||
webrtc::CodecInst& cinst)
|
||||
{
|
||||
{
|
||||
const unsigned int plNameLength = codecInfo->mName.length();
|
||||
memset(&cinst, 0, sizeof(webrtc::CodecInst));
|
||||
if(sizeof(cinst.plname) < plNameLength+1)
|
||||
|
@ -996,27 +992,22 @@ WebrtcAudioConduit::CodecConfigToWebRTCCodec(const AudioCodecConfig* codecInfo,
|
|||
}
|
||||
cinst.channels = codecInfo->mChannels;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported Sampling Frequncies.
|
||||
* Supported Sampling Frequencies.
|
||||
*/
|
||||
bool
|
||||
WebrtcAudioConduit::IsSamplingFreqSupported(int freq) const
|
||||
{
|
||||
if(GetNum10msSamplesForFrequency(freq))
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return GetNum10msSamplesForFrequency(freq) != 0;
|
||||
}
|
||||
|
||||
/* Return block-length of 10 ms audio frame in number of samples */
|
||||
unsigned int
|
||||
WebrtcAudioConduit::GetNum10msSamplesForFrequency(int samplingFreqHz) const
|
||||
{
|
||||
switch(samplingFreqHz)
|
||||
switch (samplingFreqHz)
|
||||
{
|
||||
case 16000: return 160; //160 samples
|
||||
case 32000: return 320; //320 samples
|
||||
|
|
|
@ -313,12 +313,11 @@ PayloadNameToEncoderType(const std::string& name)
|
|||
{
|
||||
if ("VP8" == name) {
|
||||
return webrtc::VideoEncoder::EncoderType::kVp8;
|
||||
} else if ("VP9" == name) {
|
||||
} else if ("VP9" == name) { // NOLINT(readability-else-after-return)
|
||||
return webrtc::VideoEncoder::EncoderType::kVp9;
|
||||
} else if ("H264" == name) {
|
||||
} else if ("H264" == name) { // NOLINT(readability-else-after-return)
|
||||
return webrtc::VideoEncoder::EncoderType::kH264;
|
||||
}
|
||||
|
||||
return webrtc::VideoEncoder::EncoderType::kUnsupportedCodec;
|
||||
}
|
||||
|
||||
|
@ -382,12 +381,11 @@ PayloadNameToDecoderType(const std::string& name)
|
|||
{
|
||||
if ("VP8" == name) {
|
||||
return webrtc::VideoDecoder::DecoderType::kVp8;
|
||||
} else if ("VP9" == name) {
|
||||
} else if ("VP9" == name) { // NOLINT(readability-else-after-return)
|
||||
return webrtc::VideoDecoder::DecoderType::kVp9;
|
||||
} else if ("H264" == name) {
|
||||
} else if ("H264" == name) { // NOLINT(readability-else-after-return)
|
||||
return webrtc::VideoDecoder::DecoderType::kH264;
|
||||
}
|
||||
|
||||
return webrtc::VideoDecoder::DecoderType::kUnsupportedCodec;
|
||||
}
|
||||
|
||||
|
@ -1887,7 +1885,8 @@ WebrtcVideoConduit::SendRtcp(const uint8_t* packet, size_t length)
|
|||
// Might be a sender report, might be a receiver report, we don't know.
|
||||
CSFLogDebug(logTag, "%s Sent RTCP Packet ", __FUNCTION__);
|
||||
return true;
|
||||
} else if (mTransmitterTransport &&
|
||||
}
|
||||
if (mTransmitterTransport &&
|
||||
NS_SUCCEEDED(mTransmitterTransport->SendRtcpPacket(packet, length))) {
|
||||
CSFLogDebug(logTag, "%s Sent RTCP Packet (sender report) ", __FUNCTION__);
|
||||
return true;
|
||||
|
@ -2014,7 +2013,8 @@ WebrtcVideoConduit::CodecPluginID()
|
|||
{
|
||||
if (mSendCodecPlugin) {
|
||||
return mSendCodecPlugin->PluginID();
|
||||
} else if (mRecvCodecPlugin) {
|
||||
}
|
||||
if (mRecvCodecPlugin) {
|
||||
return mRecvCodecPlugin->PluginID();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,11 @@ bool MediaPipelineFilter::Filter(const webrtc::RTPHeader& header,
|
|||
if (correlator == correlator_) {
|
||||
AddRemoteSSRC(header.ssrc);
|
||||
return true;
|
||||
} else {
|
||||
// Some other stream; it is possible that an SSRC has moved, so make sure
|
||||
// we don't have that SSRC in our filter any more.
|
||||
remote_ssrc_set_.erase(header.ssrc);
|
||||
return false;
|
||||
}
|
||||
// Some other stream; it is possible that an SSRC has moved, so make sure
|
||||
// we don't have that SSRC in our filter any more.
|
||||
remote_ssrc_set_.erase(header.ssrc);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (remote_ssrc_set_.count(header.ssrc)) {
|
||||
|
|
|
@ -420,7 +420,8 @@ RunStatsQuery(
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
} else if (!stsThread) {
|
||||
}
|
||||
if (!stsThread) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -542,7 +543,8 @@ RunLogQuery(const nsCString& aPattern,
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
} else if (!stsThread) {
|
||||
}
|
||||
if (!stsThread) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче