2
0
mirror of https://github.com/rehlds/revoice.git synced 2024-12-28 15:45:52 +03:00

Typo in CSteamP2PCodec::Compress

This commit is contained in:
thecrock 2015-12-14 18:06:47 +04:00
parent 81a705a87a
commit 8eb9367dcd
3 changed files with 21 additions and 3 deletions

View File

@ -112,7 +112,7 @@ int CSteamP2PCodec::Compress(const char *pUncompressedBytes, int nSamples, char
}
writePos += encodeRes;
uint32 cksum = crc32(pUncompressedBytes, writePos - pCompressed);
uint32 cksum = crc32(pCompressed, writePos - pCompressed);
*(uint32*)writePos = cksum;
writePos += 4;

View File

@ -109,7 +109,6 @@ int VoiceEncoder_Silk::Compress(const char *pUncompressedIn, int nSamplesIn, cha
int16 nBytes = originalNBytes;
int res = SKP_Silk_SDK_Encode(this->m_pEncoder, &this->m_encControl, psRead, nSamplesToEncode, (unsigned char*)pWritePos, &nBytes);
*pWritePayloadSize = nBytes; //write frame size
printf("enc: res=%d; outlen=%d;\n", res, nBytes);
pWritePos += nBytes;
psRead += nSamplesToEncode;

View File

@ -54,7 +54,26 @@ int TranscodeVoice(const char* srcBuf, int srcBufLen, IVoiceCodec* srcCodec, IVo
return 0;
}
return dstCodec->Compress(decodedBuf, numDecodedSamples, dstBuf, dstBufSize, false);
int compressedSize = dstCodec->Compress(decodedBuf, numDecodedSamples, dstBuf, dstBufSize, false);
if (compressedSize <= 0) {
return 0;
}
/*
int numDecodedSamples2 = dstCodec->Decompress(dstBuf, compressedSize, decodedBuf, sizeof(decodedBuf));
if (numDecodedSamples2 <= 0) {
return compressedSize;
}
FILE* rawSndFile = fopen("d:\\revoice_raw.snd", "ab");
if (rawSndFile) {
fwrite(decodedBuf, 2, numDecodedSamples2, rawSndFile);
fclose(rawSndFile);
}
*/
return compressedSize;
}
void SV_ParseVoiceData_emu(IGameClient* cl) {