blob: 445564c82ae0e2735d99ee949be9e756ed19b432 [file] [log] [blame]
pbos@webrtc.org289a35c2014-06-03 14:51:34 +00001/*
2 * libjingle
3 * Copyright 2014 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
pbos@webrtc.org9e65a3b2014-06-11 13:42:37 +000028#include "talk/media/webrtc/webrtcmediaengine.h"
29#include "webrtc/system_wrappers/interface/field_trial.h"
30
31WRME_EXPORT
32cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
33 webrtc::AudioDeviceModule* adm,
34 webrtc::AudioDeviceModule* adm_sc,
35 cricket::WebRtcVideoEncoderFactory* encoder_factory,
36 cricket::WebRtcVideoDecoderFactory* decoder_factory) {
37#ifdef WEBRTC_CHROMIUM_BUILD
38 if (webrtc::field_trial::FindFullName("WebRTC-NewVideoAPI") == "Enabled") {
39 return new cricket::WebRtcMediaEngine2(
40 adm, adm_sc, encoder_factory, decoder_factory);
41 }
42#endif // WEBRTC_CHROMIUM_BUILD
43 return new cricket::WebRtcMediaEngine(
44 adm, adm_sc, encoder_factory, decoder_factory);
45}
46
47WRME_EXPORT
48void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) {
buildbot@webrtc.orgbb2d6582014-06-20 14:58:56 +000049#ifdef WEBRTC_CHROMIUM_BUILD
50 if (webrtc::field_trial::FindFullName("WebRTC-NewVideoAPI") == "Enabled") {
51 delete static_cast<cricket::WebRtcMediaEngine2*>(media_engine);
52 } else {
53#endif // WEBRTC_CHROMIUM_BUILD
54 delete static_cast<cricket::WebRtcMediaEngine*>(media_engine);
55#ifdef WEBRTC_CHROMIUM_BUILD
56 }
57#endif // WEBRTC_CHROMIUM_BUILD
pbos@webrtc.org9e65a3b2014-06-11 13:42:37 +000058}