2014-12-16 13:41:36 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
|
2015-12-08 13:41:35 +01:00
|
|
|
|
2015-02-05 18:29:39 +00:00
|
|
|
#include "webrtc/base/checks.h"
|
2015-12-08 13:41:35 +01:00
|
|
|
#include "webrtc/base/trace_event.h"
|
2014-12-16 13:41:36 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-09-08 05:57:53 -07:00
|
|
|
AudioEncoder::EncodedInfo::EncodedInfo() = default;
|
|
|
|
|
|
|
|
|
|
AudioEncoder::EncodedInfo::~EncodedInfo() = default;
|
2014-12-16 13:41:36 +00:00
|
|
|
|
2015-09-08 05:57:53 -07:00
|
|
|
int AudioEncoder::RtpTimestampRateHz() const {
|
|
|
|
|
return SampleRateHz();
|
2014-12-16 13:41:36 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-06 01:21:35 -08:00
|
|
|
AudioEncoder::EncodedInfo AudioEncoder::Encode(
|
|
|
|
|
uint32_t rtp_timestamp,
|
|
|
|
|
rtc::ArrayView<const int16_t> audio,
|
|
|
|
|
size_t max_encoded_bytes,
|
|
|
|
|
uint8_t* encoded) {
|
2015-12-08 13:41:35 +01:00
|
|
|
TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
|
2015-11-06 01:21:35 -08:00
|
|
|
RTC_CHECK_EQ(audio.size(),
|
|
|
|
|
static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
|
2015-03-19 08:50:26 +00:00
|
|
|
EncodedInfo info =
|
|
|
|
|
EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded);
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes);
|
2015-03-19 08:50:26 +00:00
|
|
|
return info;
|
2015-02-05 18:29:39 +00:00
|
|
|
}
|
|
|
|
|
|
2015-09-08 05:57:53 -07:00
|
|
|
bool AudioEncoder::SetFec(bool enable) {
|
|
|
|
|
return !enable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AudioEncoder::SetDtx(bool enable) {
|
|
|
|
|
return !enable;
|
2015-01-27 18:24:45 +00:00
|
|
|
}
|
|
|
|
|
|
2015-09-08 05:57:53 -07:00
|
|
|
bool AudioEncoder::SetApplication(Application application) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-08 23:15:33 -07:00
|
|
|
void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
|
2015-09-08 05:57:53 -07:00
|
|
|
|
|
|
|
|
void AudioEncoder::SetProjectedPacketLossRate(double fraction) {}
|
|
|
|
|
|
|
|
|
|
void AudioEncoder::SetTargetBitrate(int target_bps) {}
|
|
|
|
|
|
2014-12-16 13:41:36 +00:00
|
|
|
} // namespace webrtc
|