mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
8e25689c24
Just in case Closes #6334 // FREEBIE
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#ifndef __WEB_RTC_CODEC_H__
|
|
#define __WEB_RTC_CODEC_H__
|
|
|
|
#include "AudioCodec.h"
|
|
#include <sys/types.h>
|
|
|
|
#include <modules/audio_coding/neteq/interface/audio_decoder.h>
|
|
|
|
class WebRtcCodec : public webrtc::AudioDecoder {
|
|
|
|
private:
|
|
AudioCodec &codec;
|
|
|
|
public:
|
|
WebRtcCodec(AudioCodec &codec) :
|
|
AudioDecoder(webrtc::kDecoderArbitrary), codec(codec)
|
|
{}
|
|
|
|
int Decode(const uint8_t* encoded, size_t encoded_len,
|
|
int16_t* decoded, size_t decodedMaxSize,
|
|
SpeechType* speech_type)
|
|
{
|
|
*speech_type = kSpeech;
|
|
return codec.decode((char*)encoded, encoded_len, decoded, decodedMaxSize);
|
|
}
|
|
|
|
bool HasDecodePlc() const {
|
|
return 1;
|
|
}
|
|
|
|
int DecodePlc(int num_frames, int16_t* decoded) {
|
|
return codec.conceal(num_frames, decoded);
|
|
}
|
|
|
|
int Init() { return 0; }
|
|
|
|
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const {
|
|
return (encoded_len / SPEEX_ENCODED_FRAME_SIZE) * SPEEX_FRAME_SIZE;
|
|
}
|
|
|
|
int PacketDurationRedundant(const uint8_t* encoded, size_t encoded_len) const {
|
|
return this->PacketDuration(encoded, encoded_len);
|
|
}
|
|
|
|
bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const {
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
|
|
|
|
#endif |