Xbox Cloud Gaming app for PS5 Homebrew
C
fix(ps4): set videodec2 cpuAffinity to 0x3F and guard createPeer with try-catch
Rafael Abud Ferreira591b9138f966
diff --git a/src/media/hw_decoder_ps4.cpp b/src/media/hw_decoder_ps4.cppindex 5207b9a..4c8c24f 100644--- a/src/media/hw_decoder_ps4.cpp+++ b/src/media/hw_decoder_ps4.cpp@@ -211,17 +211,20 @@ bool HwDecoder::init(int maxWidth, int maxHeight) {return false;}- // Load firmware helper modules (available on retail PS4 firmware)- for (const char* sprx : {- "/system/common/lib/libSceVdecCore.sprx",- "/system/common/lib/libSceVdecSavc.sprx",- "/system/common/lib/libSceVdecSavc2.sprx",- "/system/common/lib/libSceVdecwrap.sprx"- }) {- int res = 0;- int mrc = sceKernelLoadStartModule(sprx, 0, nullptr, 0, nullptr, &res);- XC_LOGI("hwdec: load %s -> 0x%08x", sprx, static_cast<unsigned>(mrc));+ if (rc != 0) {+ // Fallback: try loading firmware helper modules manually+ for (const char* sprx : {+ "/system/common/lib/libSceVdecCore.sprx",+ "/system/common/lib/libSceVdecSavc.sprx",+ "/system/common/lib/libSceVdecSavc2.sprx",+ "/system/common/lib/libSceVdecwrap.sprx"+ }) {+ int res = 0;+ int mrc = sceKernelLoadStartModule(sprx, 0, nullptr, 0, nullptr, &res);+ XC_LOGI("hwdec: load %s -> 0x%08x", sprx, static_cast<unsigned>(mrc));+ }}+sceSysmoduleLoadModuleInternal(0x80000015);DecoderAllocations allocs{};@@ -297,6 +300,7 @@ bool HwDecoder::init(int maxWidth, int maxHeight) {decCfg.maxDpbFrames = 4;decCfg.pipelineDepth = 1;decCfg.computeQueue = reinterpret_cast<uint64_t>(computeQueue_);+ decCfg.cpuAffinity = 0x3F; // 6 user cores on PS4 Jaguar APU (cores 0..5)decCfg.cpuPriority = 700;decCfg.optimizeProgressive = 1;diff --git a/src/stream/stream_session.cpp b/src/stream/stream_session.cppindex 60aaeed..7794cd4 100644--- a/src/stream/stream_session.cpp+++ b/src/stream/stream_session.cpp@@ -423,7 +423,13 @@ struct StreamSession::Impl {XC_LOGI("webrtc: createPeer starting");rtc::Configuration config;config.disableAutoNegotiation = true;- pc = std::make_shared<rtc::PeerConnection>(config);+ try {+ pc = std::make_shared<rtc::PeerConnection>(config);+ } catch (const std::exception& e) {+ XC_LOGE("webrtc: PeerConnection failed to create: %s", e.what());+ fail(std::string("WebRTC peer creation failed: ") + e.what());+ return;+ }XC_LOGI("webrtc: PeerConnection created");pc->onLocalCandidate([this](rtc::Candidate c) {