RemoteRealtimeMediaSource.h [plain text]
#pragma once
#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
#include <WebCore/CaptureDevice.h>
#include <WebCore/RealtimeMediaSource.h>
#include <WebCore/RealtimeMediaSourceIdentifier.h>
#include <wtf/Deque.h>
namespace IPC {
class Connection;
}
namespace WebCore {
class CAAudioStreamDescription;
class ImageTransferSessionVT;
struct MediaConstraints;
class RemoteVideoSample;
}
namespace WebKit {
class UserMediaCaptureManager;
class RemoteRealtimeMediaSource : public WebCore::RealtimeMediaSource {
public:
static Ref<WebCore::RealtimeMediaSource> create(const WebCore::CaptureDevice&, const WebCore::MediaConstraints&, String&& name, String&& hashSalt, UserMediaCaptureManager&, bool shouldCaptureInGPUProcess = false);
~RemoteRealtimeMediaSource();
WebCore::RealtimeMediaSourceIdentifier identifier() const { return m_identifier; }
IPC::Connection* connection();
void setSettings(WebCore::RealtimeMediaSourceSettings&&);
void applyConstraintsSucceeded(const WebCore::RealtimeMediaSourceSettings&);
void applyConstraintsFailed(String&& failedConstraint, String&& errorMessage);
void captureStopped();
void captureFailed() final;
void remoteVideoSampleAvailable(WebCore::RemoteVideoSample&&);
void remoteAudioSamplesAvailable(const WTF::MediaTime&, const WebCore::PlatformAudioData&, const WebCore::AudioStreamDescription&, size_t);
private:
RemoteRealtimeMediaSource(WebCore::RealtimeMediaSourceIdentifier, WebCore::CaptureDevice::DeviceType, String&& name, String&& hashSalt, UserMediaCaptureManager&, bool shouldCaptureInGPUProcess);
void startProducingData() final;
void stopProducingData() final;
bool isCaptureSource() const final { return true; }
void beginConfiguration() final { }
void commitConfiguration() final { }
bool setShouldApplyRotation(bool ) final;
void applyConstraints(const WebCore::MediaConstraints&, ApplyConstraintsHandler&&) final;
void requestToEnd(Observer&) final;
void stopBeingObserved() final;
void hasEnded() final;
const WebCore::RealtimeMediaSourceSettings& settings() final { return m_settings; }
const WebCore::RealtimeMediaSourceCapabilities& capabilities() final;
void whenReady(CompletionHandler<void(String)>&&) final;
WebCore::CaptureDevice::DeviceType deviceType() const final { return m_deviceType; }
Ref<RealtimeMediaSource> clone() final;
void didFail(String&& errorMessage);
void setAsReady();
void setCapabilities(WebCore::RealtimeMediaSourceCapabilities&&);
Ref<RealtimeMediaSource> cloneVideoSource();
WebCore::RealtimeMediaSourceIdentifier m_identifier;
UserMediaCaptureManager& m_manager;
WebCore::RealtimeMediaSourceCapabilities m_capabilities;
WebCore::RealtimeMediaSourceSettings m_settings;
std::unique_ptr<WebCore::ImageTransferSessionVT> m_imageTransferSession;
WebCore::CaptureDevice::DeviceType m_deviceType { WebCore::CaptureDevice::DeviceType::Unknown };
Deque<ApplyConstraintsHandler> m_pendingApplyConstraintsCallbacks;
bool m_shouldCaptureInGPUProcess { false };
bool m_isReady { false };
String m_errorMessage;
CompletionHandler<void(String)> m_callback;
};
}
#endif