WebrtcEnvironmentWrapper.cpp (1524B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ 6 7 #include "WebrtcEnvironmentWrapper.h" 8 9 #include "WebrtcTaskQueueWrapper.h" 10 11 // libwebrtc includes 12 #include "api/environment/environment_factory.h" 13 14 namespace mozilla { 15 16 /* static */ RefPtr<WebrtcEnvironmentWrapper> WebrtcEnvironmentWrapper::Create( 17 const dom::RTCStatsTimestampMaker& aTimestampMaker) { 18 RefPtr<WebrtcEnvironmentWrapper> wrapper = new WebrtcEnvironmentWrapper( 19 MakeUnique<webrtc::RtcEventLogNull>(), CreateWebrtcTaskQueueFactory(), 20 WrapUnique(new webrtc::MozTrialsConfig()), aTimestampMaker); 21 22 return wrapper; 23 } 24 25 WebrtcEnvironmentWrapper::WebrtcEnvironmentWrapper( 26 UniquePtr<webrtc::RtcEventLog>&& aEventLog, 27 UniquePtr<webrtc::TaskQueueFactory>&& aTaskQueueFactory, 28 UniquePtr<webrtc::FieldTrialsView>&& aTrials, 29 const dom::RTCStatsTimestampMaker& aTimestampMaker) 30 : mEventLog(std::move(aEventLog)), 31 mTaskQueueFactory(std::move(aTaskQueueFactory)), 32 mTrials(std::move(aTrials)), 33 mClock(aTimestampMaker), 34 mEnv(webrtc::CreateEnvironment(mEventLog.get(), 35 mClock.GetRealTimeClockRaw(), 36 mTaskQueueFactory.get(), mTrials.get())) {} 37 38 } // namespace mozilla