WebAudioSourceProviderAVFObjC.h [plain text]
#pragma once
#if ENABLE(WEB_AUDIO) && ENABLE(MEDIA_STREAM)
#include "CAAudioStreamDescription.h"
#include "MediaStreamTrackPrivate.h"
#include "WebAudioSourceProvider.h"
#include <CoreAudio/CoreAudioTypes.h>
#include <wtf/Lock.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
typedef struct AudioBufferList AudioBufferList;
typedef struct OpaqueAudioConverter* AudioConverterRef;
typedef struct AudioStreamBasicDescription AudioStreamBasicDescription;
typedef const struct opaqueCMFormatDescription *CMFormatDescriptionRef;
typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
namespace WebCore {
class AudioSampleDataSource;
class CAAudioStreamDescription;
class WEBCORE_EXPORT WebAudioSourceProviderAVFObjC final : public WebAudioSourceProvider, MediaStreamTrackPrivate::Observer {
public:
static Ref<WebAudioSourceProviderAVFObjC> create(MediaStreamTrackPrivate&);
virtual ~WebAudioSourceProviderAVFObjC();
void prepare(const AudioStreamBasicDescription&);
void unprepare();
private:
explicit WebAudioSourceProviderAVFObjC(MediaStreamTrackPrivate&);
void provideInput(AudioBus*, size_t) final;
void setClient(AudioSourceProviderClient*) final;
void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
void trackEnded(MediaStreamTrackPrivate&) final { }
void trackMutedChanged(MediaStreamTrackPrivate&) final { }
void trackSettingsChanged(MediaStreamTrackPrivate&) final { }
void trackEnabledChanged(MediaStreamTrackPrivate&) final { }
size_t m_listBufferSize { 0 };
std::optional<CAAudioStreamDescription> m_inputDescription;
std::optional<CAAudioStreamDescription> m_outputDescription;
RefPtr<AudioSampleDataSource> m_dataSource;
uint64_t m_writeCount { 0 };
uint64_t m_readCount { 0 };
AudioSourceProviderClient* m_client { nullptr };
MediaStreamTrackPrivate* m_captureSource { nullptr };
Lock m_mutex;
bool m_connected { false };
};
}
#endif