UE-62389 - Mic stop capturing audio at 2nd load of app

I made simple class that capture voice input from mic and I build it for android .

when the app run for first time, the capturing working fine after passing record permission and I can see data voice data output, however, once I close the app and open it again, the Capturing state set to OK but I see no data at all .

If I disabled the mic permssion manually and restarted the app, it works fine once again, close it and open it , problem happen again .

Whats wrong ?!

Here is also the CPP file
// Fill out your copyright notice in the Description page of Project Settings.

#include "SoundCapture.h"
#include "OnlineSubsystemUtils.h"



// Sets default values
ASoundCapture::ASoundCapture()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
}

void ASoundCapture::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);	
	isCapture = false;    
}

void ASoundCapture::FinishDestroy()
{
	isCapture = false;
	if (VoiceCapture.IsValid())
	{    		
		VoiceCapture->Stop();
		VoiceCapture->Shutdown();
	}    	
	Super::FinishDestroy();    	
}  

void ASoundCapture::StartCaptureVoice()
{    	
	VoiceCapture = /*FVoiceModule::CreateVoiceCapture("", 512, 32);*/      FVoiceModule::Get().CreateVoiceCapture();
	
	VoiceCapture->Start();
	isCapture = true;
}

// Called when the game starts or when spawned
void ASoundCapture::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Warning, TEXT("Custom player controller initialized"));
	isCapture = false;	
}

// Called every frame
void ASoundCapture::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if (isCapture)
	{
		VoiceCaptureBytesAvailable = 0;
		CaptureState = VoiceCapture->GetCaptureState(VoiceCaptureBytesAvailable);

		UE_LOG(LogTemp, Warning, TEXT("Bytes available: %d\nCapture state: %s"), VoiceCaptureBytesAvailable, EVoiceCaptureState::ToString(CaptureState));
		GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Yellow, EVoiceCaptureState::ToString(CaptureState));
		VoiceCaptureBuffer.Reset();

		if (CaptureState == EVoiceCaptureState::Ok && VoiceCaptureBytesAvailable > 0)
		{	
			VoiceCaptureTotalSquared = 0;
			VoiceCaptureBuffer.SetNumUninitialized(VoiceCaptureBytesAvailable);

			VoiceCapture->GetVoiceData(VoiceCaptureBuffer.GetData(), VoiceCaptureBytesAvailable, VoiceCaptureReadBytes);

			for (uint32 i = 0; i < (VoiceCaptureReadBytes / 2); i++)
			{
				VoiceCaptureSample = (VoiceCaptureBuffer[i * 2 + 1] << 8) | VoiceCaptureBuffer[i * 2];
				VoiceCaptureTotalSquared += ((float)VoiceCaptureSample * (float)VoiceCaptureSample);
			}

			VoiceCaptureMeanSquare = (2 * (VoiceCaptureTotalSquared / VoiceCaptureBuffer.Num()));
			VoiceCaptureRms = FMath::Sqrt(VoiceCaptureMeanSquare);
			VoiceCaptureFinalVolume = ((VoiceCaptureRms / 32768.0) * 200.f);
			VeryCleanString = FString::SanitizeFloat(VoiceCaptureFinalVolume);
			//VoiceCaptureVolume = VoiceCaptureFinalVolume;

			GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, VeryCleanString);
		}
	}	
}

I’ve checked with monitor.bat , log at first time has no errors, but when I start the app once again i get this strange error E/AudioRecord(24604): start() status -38

Android 6 used .

Here is the full LOG FullLog

I made sure that I stopped and shutdown the IVoiceCapture on EndPlay() to release the resource , but it seems not , cuz I’ve checked on stackoverflow that this issue happened when I dont release the recordDriver on exit .
Here is the link https://stackoverflow.com/questions/20460892/audiorecord-start-status-38

Up , I think its a bug .

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

I will once I’m home, but can at least we get some attention from developer staff if possible?

Thanks:)

I’ve did bug report, however I forgot to include the Log , but I shared link of this thread with them . could u please if possible link the log file that I already attached in this thread to case number : Case # 00024739

as I know its critical to be included in the bug report . and I dont want to make a duplicate one just to include the log file

Thanks

UP until death:D

there is a bug reported finally submitted .

Hope everyone vote for it to fix as soon

Does anyone could find a fast solution?

2021 sep and i ran into same bug.