Add diagnostic logs for Opus codec initialization and audio multicast
- Log at InitOpusCodec: FVoiceModule availability, encoder/decoder creation, net role - Log at HandleAudioReceived: warn once if encoder is null or role is not Authority - These fire unconditionally (not behind bDebug) to catch the root cause Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1990b828a2
commit
5e1c50edf8
@ -638,6 +638,19 @@ void UPS_AI_ConvAgent_ElevenLabsComponent::HandleAudioReceived(const TArray<uint
|
||||
}
|
||||
|
||||
// Network: Opus-compress and broadcast to all clients before local playback.
|
||||
if (GetOwnerRole() != ROLE_Authority || !OpusEncoder.IsValid())
|
||||
{
|
||||
static bool bWarnedOnce = false;
|
||||
if (!bWarnedOnce)
|
||||
{
|
||||
bWarnedOnce = true;
|
||||
UE_LOG(LogPS_AI_ConvAgent_ElevenLabs, Warning,
|
||||
TEXT("[NET-SRV] Cannot multicast audio! Role=%d (need %d=Authority), OpusEncoder=%s, FVoiceModule=%s"),
|
||||
static_cast<int32>(GetOwnerRole()), static_cast<int32>(ROLE_Authority),
|
||||
OpusEncoder.IsValid() ? TEXT("VALID") : TEXT("NULL"),
|
||||
FVoiceModule::IsAvailable() ? TEXT("available") : TEXT("UNAVAILABLE"));
|
||||
}
|
||||
}
|
||||
if (GetOwnerRole() == ROLE_Authority && OpusEncoder.IsValid())
|
||||
{
|
||||
uint32 CompressedSize = static_cast<uint32>(OpusWorkBuffer.Num());
|
||||
@ -1453,10 +1466,16 @@ void UPS_AI_ConvAgent_ElevenLabsComponent::MulticastAgentStartedGenerating_Imple
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
void UPS_AI_ConvAgent_ElevenLabsComponent::InitOpusCodec()
|
||||
{
|
||||
if (!FVoiceModule::IsAvailable()) return;
|
||||
if (!FVoiceModule::IsAvailable())
|
||||
{
|
||||
UE_LOG(LogPS_AI_ConvAgent_ElevenLabs, Warning,
|
||||
TEXT("[OPUS] FVoiceModule NOT available — Opus codec disabled. Network audio will NOT work."));
|
||||
return;
|
||||
}
|
||||
FVoiceModule& VoiceModule = FVoiceModule::Get();
|
||||
|
||||
if (GetOwnerRole() == ROLE_Authority)
|
||||
const ENetRole Role = GetOwnerRole();
|
||||
if (Role == ROLE_Authority)
|
||||
{
|
||||
OpusEncoder = VoiceModule.CreateVoiceEncoder(
|
||||
PS_AI_ConvAgent_Audio_ElevenLabs::SampleRate,
|
||||
@ -1469,6 +1488,12 @@ void UPS_AI_ConvAgent_ElevenLabsComponent::InitOpusCodec()
|
||||
PS_AI_ConvAgent_Audio_ElevenLabs::Channels);
|
||||
|
||||
OpusWorkBuffer.SetNumUninitialized(8 * 1024); // 8 KB scratch buffer for Opus encode/decode
|
||||
|
||||
UE_LOG(LogPS_AI_ConvAgent_ElevenLabs, Log,
|
||||
TEXT("[OPUS] Init complete — Role=%d Encoder=%s Decoder=%s"),
|
||||
static_cast<int32>(Role),
|
||||
OpusEncoder.IsValid() ? TEXT("OK") : TEXT("NULL"),
|
||||
OpusDecoder.IsValid() ? TEXT("OK") : TEXT("NULL"));
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user