mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Removed hardcoded samples per frame
This commit is contained in:
parent
1d65baa981
commit
ad94978f98
@ -8,8 +8,6 @@
|
|||||||
#include <opus_multistream.h>
|
#include <opus_multistream.h>
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
#define PCM_FRAME_SIZE 240
|
|
||||||
|
|
||||||
static OpusMSDecoder* Decoder;
|
static OpusMSDecoder* Decoder;
|
||||||
static OPUS_MULTISTREAM_CONFIGURATION OpusConfig;
|
static OPUS_MULTISTREAM_CONFIGURATION OpusConfig;
|
||||||
|
|
||||||
@ -226,7 +224,7 @@ int BridgeArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We know ahead of time what the buffer size will be for decoded audio, so pre-allocate it
|
// We know ahead of time what the buffer size will be for decoded audio, so pre-allocate it
|
||||||
DecodedAudioBuffer = (*env)->NewGlobalRef(env, (*env)->NewByteArray(env, opusConfig->channelCount * PCM_FRAME_SIZE * sizeof(short)));
|
DecodedAudioBuffer = (*env)->NewGlobalRef(env, (*env)->NewByteArray(env, opusConfig->channelCount * opusConfig->samplesPerFrame * sizeof(short)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -279,7 +277,7 @@ void BridgeArDecodeAndPlaySample(char* sampleData, int sampleLength) {
|
|||||||
(const unsigned char*)sampleData,
|
(const unsigned char*)sampleData,
|
||||||
sampleLength,
|
sampleLength,
|
||||||
(opus_int16*)decodedData,
|
(opus_int16*)decodedData,
|
||||||
PCM_FRAME_SIZE,
|
OpusConfig.samplesPerFrame,
|
||||||
0);
|
0);
|
||||||
if (decodeLen > 0) {
|
if (decodeLen > 0) {
|
||||||
// We must release the array elements first to ensure the data is copied before the callback
|
// We must release the array elements first to ensure the data is copied before the callback
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a7d4537274f42f30d48a7a09876d9ec4a0f70813
|
Subproject commit 59481c085a7f774c5d30374636f8bc75da7c676c
|
Loading…
x
Reference in New Issue
Block a user