mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-01 23:35:47 +00:00
Enable audio encryption unless on a slow CPU
This commit is contained in:
parent
b907c4b608
commit
30464979dc
15
src/config.c
15
src/config.c
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "input/evdev.h"
|
||||
#include "audio/audio.h"
|
||||
@ -328,6 +329,20 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) {
|
||||
config->stream.streamingRemotely = STREAM_CFG_AUTO;
|
||||
config->stream.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
||||
config->stream.supportsHevc = false;
|
||||
config->stream.encryptionFlags = ENCFLG_AUDIO;
|
||||
|
||||
#ifdef __arm__
|
||||
char cpuinfo[4096] = {};
|
||||
if (read_file("/proc/cpuinfo", cpuinfo, sizeof(cpuinfo)) > 0) {
|
||||
// If this is a ARMv6 CPU (like the Pi 1), we'll assume it's not
|
||||
// powerful enough to handle audio encryption. The Pi 1 could
|
||||
// barely handle Opus decoding alone.
|
||||
if (strstr(cpuinfo, "ARMv6")) {
|
||||
config->stream.encryptionFlags = ENCFLG_NONE;
|
||||
printf("Disabling audio encryption on low performance CPU\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
config->debug_level = 0;
|
||||
config->platform = "auto";
|
||||
|
12
src/util.c
12
src/util.c
@ -38,3 +38,15 @@ int blank_fb(char *path, bool clear) {
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int read_file(char *path, char* output, int output_len) {
|
||||
int fd = open(path, O_RDONLY);
|
||||
|
||||
if(fd >= 0) {
|
||||
output_len = read(fd, output, output_len);
|
||||
close(fd);
|
||||
return output_len;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -20,3 +20,4 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
int blank_fb(char *path, bool clear);
|
||||
int read_file(char *path, char *output, int output_len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user