aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorrdenno <rhysdenno@gmail.com>2026-10-31 12:14:21 -0400
committerJonas <baguettegamerofficial2020@gmail.com>2026-11-03 05:55:03 +0600
commit701c91b402f47fdbb36d4f7c4b4bf1d0db08888b (patch)
tree038b9bcd39b7c62f77616a4277ab8c43deb90ce3 /src/core/hle/service
parentbfd6430918ff4eda8c8c0e5fd0a927b3f64ff258 (diff)
nx2: vdecsvc picks H.264 when the configure carries no codec name and the stream is H.264 (Yoshi demo)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/nx2_gsv.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/core/hle/service/nx2_gsv.h b/src/core/hle/service/nx2_gsv.h
index e488be098c..3e29076b8e 100644
--- a/src/core/hle/service/nx2_gsv.h
+++ b/src/core/hle/service/nx2_gsv.h
@@ -2447,10 +2447,31 @@ private:
void Configure(HLERequestContext& ctx) {
const auto* w = ctx.CommandBuffer();
std::string codec;
+ std::span<const u8> name_buf;
if (!ctx.BufferDescriptorA().empty()) {
- const auto name = ctx.ReadBufferA(0);
- codec.assign(reinterpret_cast<const char*>(name.data()),
- strnlen(reinterpret_cast<const char*>(name.data()), name.size()));
+ name_buf = ctx.ReadBufferA(0);
+ codec.assign(reinterpret_cast<const char*>(name_buf.data()),
+ strnlen(reinterpret_cast<const char*>(name_buf.data()), name_buf.size()));
+ }
+ if (name_buf.empty() && !ctx.BufferDescriptorX().empty()) {
+ name_buf = ctx.ReadBufferX(0);
+ codec.assign(reinterpret_cast<const char*>(name_buf.data()),
+ strnlen(reinterpret_cast<const char*>(name_buf.data()), name_buf.size()));
+ }
+ if (!name_buf.empty()) {
+ if (codec.empty()) {
+ const std::string_view sv{reinterpret_cast<const char*>(name_buf.data()), name_buf.size()};
+ for (const auto& candidate : {"video/avc", "video/vp9", "video/vp8", "video/hevc"}) {
+ if (sv.find(candidate) != std::string_view::npos) {
+ codec = candidate;
+ break;
+ }
+ }
+ }
+ if (codec.empty()) {
+ LOG_INFO(Service, "{} configure: no codec name in {:02x}", GetServiceName(),
+ fmt::join(name_buf, " "));
+ }
}
Log(ctx, "configure");
LOG_INFO(Service, "{} configure codec \"{}\" {}x{} rate {}", GetServiceName(), codec, w[5],
@@ -2679,7 +2700,13 @@ private:
if (!m_stream_ended) {
m_ready->room.store(m_inputs.size() < MaxQueuedInputs, std::memory_order_relaxed);
}
- const std::string codec = m_codec;
+ std::string codec = m_codec;
+ if (codec.empty() && Tegra::Host1x::IsH264Stream(input.data)) {
+ codec = "video/avc";
+ m_codec = codec;
+ LOG_INFO(Service, "{} empty codec, detected H.264 stream: using \"{}\"",
+ GetServiceName(), codec);
+ }
lk.unlock();
if (!decoder || decoder->Name() != codec) {
decoder = std::make_unique<Tegra::Host1x::Nx2VideoDecoder>(codec);