pbos@webrtc.org | 289a35c | 2014-06-03 14:51:34 +0000 | [diff] [blame] | 1 | /* |
| 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.org | e77c9c8 | 2015-03-11 10:49:33 +0000 | [diff] [blame] | 28 | #if defined(LIBPEERCONNECTION_LIB) || defined(LIBPEERCONNECTION_IMPLEMENTATION) |
buildbot@webrtc.org | 95bbd18 | 2014-08-20 07:49:30 +0000 | [diff] [blame] | 29 | |
pbos@webrtc.org | 9e65a3b | 2014-06-11 13:42:37 +0000 | [diff] [blame] | 30 | #include "talk/media/webrtc/webrtcmediaengine.h" |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 31 | #include "talk/media/webrtc/webrtcvideoengine2.h" |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 32 | #include "talk/media/webrtc/webrtcvoiceengine.h" |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 33 | |
| 34 | namespace cricket { |
| 35 | |
pbos@webrtc.org | e77c9c8 | 2015-03-11 10:49:33 +0000 | [diff] [blame] | 36 | class WebRtcMediaEngine2 |
| 37 | : public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2> { |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 38 | public: |
| 39 | WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm, |
| 40 | webrtc::AudioDeviceModule* adm_sc, |
| 41 | WebRtcVideoEncoderFactory* encoder_factory, |
| 42 | WebRtcVideoDecoderFactory* decoder_factory) { |
| 43 | voice_.SetAudioDeviceModule(adm, adm_sc); |
pbos@webrtc.org | 0a2087a | 2014-09-23 09:40:22 +0000 | [diff] [blame] | 44 | video_.SetExternalDecoderFactory(decoder_factory); |
| 45 | video_.SetExternalEncoderFactory(encoder_factory); |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 46 | } |
| 47 | }; |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 48 | |
| 49 | } // namespace cricket |
pbos@webrtc.org | 9e65a3b | 2014-06-11 13:42:37 +0000 | [diff] [blame] | 50 | |
| 51 | WRME_EXPORT |
| 52 | cricket::MediaEngineInterface* CreateWebRtcMediaEngine( |
| 53 | webrtc::AudioDeviceModule* adm, |
| 54 | webrtc::AudioDeviceModule* adm_sc, |
| 55 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 56 | cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
tommi@webrtc.org | b789f62 | 2015-03-22 12:50:30 +0000 | [diff] [blame] | 57 | return new cricket::WebRtcMediaEngine2(adm, adm_sc, encoder_factory, |
| 58 | decoder_factory); |
pbos@webrtc.org | 9e65a3b | 2014-06-11 13:42:37 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | WRME_EXPORT |
| 62 | void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 63 | delete media_engine; |
pbos@webrtc.org | 9e65a3b | 2014-06-11 13:42:37 +0000 | [diff] [blame] | 64 | } |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 65 | |
| 66 | namespace cricket { |
| 67 | |
buildbot@webrtc.org | 95bbd18 | 2014-08-20 07:49:30 +0000 | [diff] [blame] | 68 | // Used by PeerConnectionFactory to create a media engine passed into |
| 69 | // ChannelManager. |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 70 | MediaEngineInterface* WebRtcMediaEngineFactory::Create( |
| 71 | webrtc::AudioDeviceModule* adm, |
| 72 | webrtc::AudioDeviceModule* adm_sc, |
| 73 | WebRtcVideoEncoderFactory* encoder_factory, |
| 74 | WebRtcVideoDecoderFactory* decoder_factory) { |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 75 | return CreateWebRtcMediaEngine(adm, adm_sc, encoder_factory, decoder_factory); |
henrike@webrtc.org | 0481f15 | 2014-08-19 14:56:59 +0000 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | } // namespace cricket |
buildbot@webrtc.org | 95bbd18 | 2014-08-20 07:49:30 +0000 | [diff] [blame] | 79 | |
| 80 | #endif // defined(LIBPEERCONNECTION_LIB) || |
| 81 | // defined(LIBPEERCONNECTION_IMPLEMENTATION) |