LibWebRTCProviderCocoa.cpp [plain text]
#include "config.h"
#include "LibWebRTCProviderCocoa.h"
#if USE(LIBWEBRTC)
#include <webrtc/sdk/WebKit/WebKitUtilities.h>
#include <wtf/MainThread.h>
#include <wtf/darwin/WeakLinking.h>
namespace WebCore {
UniqueRef<LibWebRTCProvider> LibWebRTCProvider::create()
{
return makeUniqueRef<LibWebRTCProviderCocoa>();
}
LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa()
{
}
void LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed(bool allowed)
{
webrtc::setH264HardwareEncoderAllowed(allowed);
}
std::unique_ptr<webrtc::VideoDecoderFactory> LibWebRTCProviderCocoa::createDecoderFactory()
{
ASSERT(isMainThread());
auto codecSupport = m_supportsVP8 ? webrtc::WebKitCodecSupport::H264AndVP8 : webrtc::WebKitCodecSupport::H264;
return webrtc::createWebKitDecoderFactory(codecSupport);
}
std::unique_ptr<webrtc::VideoEncoderFactory> LibWebRTCProviderCocoa::createEncoderFactory()
{
ASSERT(isMainThread());
auto codecSupport = m_supportsVP8 ? webrtc::WebKitCodecSupport::H264AndVP8 : webrtc::WebKitCodecSupport::H264;
return webrtc::createWebKitEncoderFactory(codecSupport);
}
void LibWebRTCProviderCocoa::setActive(bool value)
{
webrtc::setApplicationStatus(value);
}
bool LibWebRTCProvider::webRTCAvailable()
{
#if PLATFORM(IOS)
return true;
#else
return !isNullFunctionPointer(rtc::LogMessage::LogToDebug);
#endif
}
}
#endif // USE(LIBWEBRTC)