From f2c262cdb4c9f96bdd55730a70f3748782551ef4 Mon Sep 17 00:00:00 2001 From: thecrock Date: Mon, 14 Dec 2015 21:49:28 +0400 Subject: [PATCH] Access to pending samples in the Silk encoding buffer --- revoice/src/SteamP2PCodec.cpp | 2 +- revoice/src/SteamP2PCodec.h | 6 ++++-- revoice/src/VoiceEncoder_Silk.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/revoice/src/SteamP2PCodec.cpp b/revoice/src/SteamP2PCodec.cpp index 3a78353..970ad74 100644 --- a/revoice/src/SteamP2PCodec.cpp +++ b/revoice/src/SteamP2PCodec.cpp @@ -1,6 +1,6 @@ #include "precompiled.h" -CSteamP2PCodec::CSteamP2PCodec(IVoiceCodec* backend) { +CSteamP2PCodec::CSteamP2PCodec(VoiceEncoder_Silk* backend) { m_BackendCodec = backend; } diff --git a/revoice/src/SteamP2PCodec.h b/revoice/src/SteamP2PCodec.h index c7cf8b5..a21e55a 100644 --- a/revoice/src/SteamP2PCodec.h +++ b/revoice/src/SteamP2PCodec.h @@ -5,16 +5,18 @@ class CSteamP2PCodec : public IVoiceCodec { public: - CSteamP2PCodec(IVoiceCodec* backend); + CSteamP2PCodec(VoiceEncoder_Silk* backend); virtual bool Init(int quality); virtual void Release(); virtual int Compress(const char *pUncompressedBytes, int nSamples, char *pCompressed, int maxCompressedBytes, bool bFinal); virtual int Decompress(const char *pCompressed, int compressedBytes, char *pUncompressed, int maxUncompressedBytes); virtual bool ResetState(); + VoiceEncoder_Silk* GetSilkCodec() const { return m_BackendCodec; } + private: int StreamDecode(const char *pCompressed, int compressedBytes, char *pUncompressed, int maxUncompressedBytes) const; int StreamEncode(const char *pUncompressedBytes, int nSamples, char *pCompressed, int maxCompressedBytes, bool bFinal) const; private: - IVoiceCodec* m_BackendCodec; + VoiceEncoder_Silk* m_BackendCodec; }; \ No newline at end of file diff --git a/revoice/src/VoiceEncoder_Silk.h b/revoice/src/VoiceEncoder_Silk.h index a961fe6..b597952 100644 --- a/revoice/src/VoiceEncoder_Silk.h +++ b/revoice/src/VoiceEncoder_Silk.h @@ -27,4 +27,5 @@ public: virtual int Compress(const char *pUncompressedBytes, int nSamples, char *pCompressed, int maxCompressedBytes, bool bFinal); virtual int Decompress(const char *pCompressed, int compressedBytes, char *pUncompressed, int maxUncompressedBytes); + int GetNumQueuedEncodingSamples() const { return m_bufOverflowBytes.TellPut() / 2; } }; /* size: 100 */ \ No newline at end of file