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