LibWebRTCCodecsProxy.h [plain text]
#pragma once
#if USE(LIBWEBRTC) && PLATFORM(COCOA) && ENABLE(GPU_PROCESS)
#include "MessageReceiver.h"
#include "RTCDecoderIdentifier.h"
#include "RTCEncoderIdentifier.h"
#include <WebCore/ImageTransferSessionVT.h>
namespace IPC {
class Connection;
class Decoder;
class DataReference;
}
namespace WebCore {
class RemoteVideoSample;
}
namespace webrtc {
using LocalDecoder = void*;
using LocalEncoder = void*;
}
namespace WebKit {
class GPUConnectionToWebProcess;
class LibWebRTCCodecsProxy : private IPC::MessageReceiver {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit LibWebRTCCodecsProxy(GPUConnectionToWebProcess&);
~LibWebRTCCodecsProxy();
void didReceiveMessageFromWebProcess(IPC::Connection& connection, IPC::Decoder& decoder) { didReceiveMessage(connection, decoder); }
private:
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
void createH264Decoder(RTCDecoderIdentifier);
void createH265Decoder(RTCDecoderIdentifier);
void releaseDecoder(RTCDecoderIdentifier);
void decodeFrame(RTCDecoderIdentifier, uint32_t timeStamp, const IPC::DataReference&);
void createEncoder(RTCEncoderIdentifier, const String&, const Vector<std::pair<String, String>>&);
void releaseEncoder(RTCEncoderIdentifier);
void initializeEncoder(RTCEncoderIdentifier, uint16_t width, uint16_t height, unsigned startBitrate, unsigned maxBitrate, unsigned minBitrate, uint32_t maxFramerate);
void encodeFrame(RTCEncoderIdentifier, WebCore::RemoteVideoSample&&, bool shouldEncodeAsKeyFrame);
void setEncodeRates(RTCEncoderIdentifier, uint32_t bitRate, uint32_t frameRate);
CFDictionaryRef ioSurfacePixelBufferCreationOptions(IOSurfaceRef);
GPUConnectionToWebProcess& m_gpuConnectionToWebProcess;
HashMap<RTCDecoderIdentifier, webrtc::LocalDecoder> m_decoders;
HashMap<RTCEncoderIdentifier, webrtc::LocalEncoder> m_encoders;
std::unique_ptr<WebCore::ImageTransferSessionVT> m_imageTransferSession;
};
}
#endif