You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
31 lines
699 B
C++
31 lines
699 B
C++
|
|
// Copyright Epic Games, Inc. All Rights Reserved
|
||
|
|
|
||
|
|
#include "AudioEncoder.h"
|
||
|
|
#include "Misc/ScopeLock.h"
|
||
|
|
|
||
|
|
namespace AVEncoder
|
||
|
|
{
|
||
|
|
void FAudioEncoder::RegisterListener(IAudioEncoderListener& Listener)
|
||
|
|
{
|
||
|
|
FScopeLock lock{ &ListenersMutex };
|
||
|
|
check(Listeners.Find(&Listener) == INDEX_NONE);
|
||
|
|
Listeners.AddUnique(&Listener);
|
||
|
|
}
|
||
|
|
|
||
|
|
void FAudioEncoder::UnregisterListener(IAudioEncoderListener& Listener)
|
||
|
|
{
|
||
|
|
FScopeLock lock{ &ListenersMutex };
|
||
|
|
int32 Count = Listeners.Remove(&Listener);
|
||
|
|
check(Count == 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
void FAudioEncoder::OnEncodedAudioFrame(const FMediaPacket& Packet)
|
||
|
|
{
|
||
|
|
FScopeLock lock{ &ListenersMutex };
|
||
|
|
for (auto&& L : Listeners)
|
||
|
|
{
|
||
|
|
L->OnEncodedAudioFrame(Packet);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|