Moved codec-specific audio packet splitting into decoders.

There's still some code run specifically for Opus w/ FEC. It will be
addressed in a separate CL.

BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2326003002
Cr-Commit-Position: refs/heads/master@{#14319}
This commit is contained in:
ossu
2016-09-21 01:57:31 -07:00
committed by Commit bot
parent 3442579fd7
commit 0d526d558b
26 changed files with 571 additions and 685 deletions

View File

@ -11,6 +11,7 @@
#include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
namespace webrtc {
@ -44,6 +45,16 @@ int AudioDecoderPcm16B::DecodeInternal(const uint8_t* encoded,
return static_cast<int>(ret);
}
std::vector<AudioDecoder::ParseResult> AudioDecoderPcm16B::ParsePayload(
rtc::Buffer&& payload,
uint32_t timestamp,
bool is_primary) {
const int samples_per_ms = rtc::CheckedDivExact(sample_rate_hz_, 1000);
return LegacyEncodedAudioFrame::SplitBySamples(
this, std::move(payload), timestamp, is_primary,
samples_per_ms * 2 * num_channels_, samples_per_ms);
}
int AudioDecoderPcm16B::PacketDuration(const uint8_t* encoded,
size_t encoded_len) const {
// Two encoded byte per sample per channel.

View File

@ -20,6 +20,9 @@ class AudioDecoderPcm16B final : public AudioDecoder {
public:
AudioDecoderPcm16B(int sample_rate_hz, size_t num_channels);
void Reset() override;
std::vector<ParseResult> ParsePayload(rtc::Buffer&& payload,
uint32_t timestamp,
bool is_primary) override;
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
int SampleRateHz() const override;
size_t Channels() const override;

View File

@ -13,6 +13,8 @@
'type': 'static_library',
'dependencies': [
'audio_encoder_interface',
'audio_decoder_interface',
'legacy_encoded_audio_frame',
'g711',
],
'sources': [