cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Fetching Voip PCM Data

Anonymous
Not applicable
I am trying to gain low level access to Voip data so I can potentially either record the incoming and outgoing voip data separately or potentially combine it and I have been able to successfully integrate voip into my project using the sample StartVoip method defined in the OSSSessionWidget.cpp provided with the Oculus Platform SDK.

To retrieve the Voip data I have been trying to use the ovr_Voip_GetPCM and ovr_Voip_GetPCMFloat methods, but I get the following error:
Error: Fetching Voip PCM Data

I don't have access to the source file so I can't determine why this error is occurring, but I'm pretty sure I'm doing something wrong. Below is my attempt:



	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();

FNamedOnlineSession *Session = SessionInterface->GetNamedSession(NAME_GameSession);
TSharedPtr<const FUniqueNetId> UserId = IdentityInterface->GetUniquePlayerId(0);

if (Session) {
UE_LOG(LogTemp, Warning, TEXT("UOculusVOIP::GetVoipData() - Session is valid"));

TArray< TSharedRef<const FUniqueNetId> > SessionPlayers = Session->RegisteredPlayers;
UE_LOG(LogTemp, Warning, TEXT("LocalOwnerId: %s"), *Session->LocalOwnerId->ToString());

UE_LOG(LogTemp, Warning, TEXT("UOculusVOIP::GetVoipData() - Fetching Voip PCM Data"));
UE_LOG(LogTemp, Warning, TEXT("UOculusVOIP::GetVoipData() - Max Output Buffer Size: %d"), ovr_Voip_GetOutputBufferMaxSize());

ovrID id = 1234567890123456; // example id: either host or client (Oculus User ID)
size_t BufferCount = ovr_Voip_GetPCMSize(id);
float* OutBufferFloat = (float*)malloc(ovr_Voip_GetOutputBufferMaxSize() * sizeof(float));
int16_t* OutBufferInt = (int16_t*)malloc(ovr_Voip_GetOutputBufferMaxSize() * sizeof(int16_t));

size_t pcmSize = ovr_Voip_GetPCM(id, OutBufferInt, BufferCount);
UE_LOG(LogTemp, Warning, TEXT("UOculusVoip::GetVoipData() - ovr_Voip_GetPCM = %d"), pcmSize);

// ovr_Voip_GetPCMFloat(id, OutBufferFloat, BufferCount);
}
else
{
UE_LOG(LogTemp, Error, TEXT("UOculusVOIP::GetVoipData() - Session is invalid"));
}


Update - I just discovered the GetRemoteTalkerOutput() method, but it's returning nullptr. It says that it will return null if the VoiceEngine does not support tapping incoming audio.Below is my attempt, but once again I'm probably doing something wrong.

	Audio::FPatchOutputStrongPtr RemoteOut = VoiceInterface->GetRemoteTalkerOutput();
if (RemoteOut.IsValid())
{
int32 SampleCount = RemoteOut->GetNumSamplesAvailable();
float* AudioOutBuffer = (float*)malloc(sizeof(float) * SampleCount);
MicOut->PopAudio(AudioOutBuffer, SampleCount, false);
UE_LOG(LogTemp, Error, TEXT("RemoteOut Audio Popped"));
}
else
{
UE_LOG(LogTemp, Error, TEXT("RemoteOut is invalid"));
}

1 REPLY 1

Anonymous
Not applicable
NA