Revert of WebRtcVoiceMediaChannel::AddRecvStream: Don't call SetRecPayloadType (patchset #13 id:260001 of https://codereview.webrtc.org/2686043006/ )

Reason for revert:
Makes perf and Chromium FYI bots unhappy.

Original issue's description:
> WebRtcVoiceMediaChannel::AddRecvStream: Don't call SetRecPayloadType
>
> This removes one more place where we were unable to handle codecs not
> in the built-in set.
>
> BUG=webrtc:5805
>
> Review-Url: https://codereview.webrtc.org/2686043006
> Cr-Commit-Position: refs/heads/master@{#17370}
> Committed: 1724cfbdba

TBR=ossu@webrtc.org,solenberg@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2772043002
Cr-Commit-Position: refs/heads/master@{#17374}
This commit is contained in:
kwiberg
2017-03-24 05:56:21 -07:00
committed by Commit bot
parent 6d7900de66
commit 670a7f3611
28 changed files with 150 additions and 221 deletions

View File

@ -179,10 +179,6 @@ int AcmReceiver::GetAudio(int desired_freq_hz,
return 0;
}
void AcmReceiver::SetCodecs(const std::map<int, SdpAudioFormat>& codecs) {
neteq_->SetCodecs(codecs);
}
int32_t AcmReceiver::AddCodec(int acm_codec_id,
uint8_t payload_type,
size_t channels,

View File

@ -79,9 +79,6 @@ class AcmReceiver {
//
int GetAudio(int desired_freq_hz, AudioFrame* audio_frame, bool* muted);
// Replace the current set of decoders with the specified set.
void SetCodecs(const std::map<int, SdpAudioFormat>& codecs);
//
// Adds a new codec to the NetEq codec database.
//

View File

@ -121,8 +121,6 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
// Get current playout frequency.
int PlayoutFrequency() const override;
void SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) override;
bool RegisterReceiveCodec(int rtp_payload_type,
const SdpAudioFormat& audio_format) override;
@ -320,6 +318,16 @@ void UpdateCodecTypeHistogram(size_t codec_type) {
webrtc::AudioEncoder::CodecType::kMaxLoggedAudioCodecTypes));
}
// TODO(turajs): the same functionality is used in NetEq. If both classes
// need them, make it a static function in ACMCodecDB.
bool IsCodecRED(const CodecInst& codec) {
return (STR_CASE_CMP(codec.plname, "RED") == 0);
}
bool IsCodecCN(const CodecInst& codec) {
return (STR_CASE_CMP(codec.plname, "CN") == 0);
}
// Stereo-to-mono can be used as in-place.
int DownMix(const AudioFrame& frame,
size_t length_out_buff,
@ -948,6 +956,19 @@ int AudioCodingModuleImpl::InitializeReceiverSafe() {
receiver_.SetMaximumDelay(0);
receiver_.FlushBuffers();
// Register RED and CN.
auto db = acm2::RentACodec::Database();
for (size_t i = 0; i < db.size(); i++) {
if (IsCodecRED(db[i]) || IsCodecCN(db[i])) {
if (receiver_.AddCodec(static_cast<int>(i),
static_cast<uint8_t>(db[i].pltype), 1,
db[i].plfreq, nullptr, db[i].plname) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot register master codec.");
return -1;
}
}
}
receiver_initialized_ = true;
return 0;
}
@ -966,12 +987,6 @@ int AudioCodingModuleImpl::PlayoutFrequency() const {
return receiver_.last_output_sample_rate_hz();
}
void AudioCodingModuleImpl::SetReceiveCodecs(
const std::map<int, SdpAudioFormat>& codecs) {
rtc::CritScope lock(&acm_crit_sect_);
receiver_.SetCodecs(codecs);
}
bool AudioCodingModuleImpl::RegisterReceiveCodec(
int rtp_payload_type,
const SdpAudioFormat& audio_format) {