| OLD | NEW |
| (Empty) |
| 1 // | |
| 2 // libjingle | |
| 3 // Copyright 2004--2007, 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 | |
| 28 #include "talk/examples/call/mediaenginefactory.h" | |
| 29 | |
| 30 #include "talk/media/base/fakemediaengine.h" | |
| 31 #include "talk/media/base/filemediaengine.h" | |
| 32 #include "talk/media/base/mediaengine.h" | |
| 33 #include "webrtc/base/stringutils.h" | |
| 34 | |
| 35 std::vector<cricket::AudioCodec> RequiredAudioCodecs() { | |
| 36 std::vector<cricket::AudioCodec> audio_codecs; | |
| 37 audio_codecs.push_back( | |
| 38 cricket::AudioCodec(9, "G722", 16000, 0, 1, 0)); | |
| 39 audio_codecs.push_back( | |
| 40 cricket::AudioCodec(0, "PCMU", 8000, 0, 1, 0)); | |
| 41 audio_codecs.push_back( | |
| 42 cricket::AudioCodec(13, "CN", 8000, 0, 1, 0)); | |
| 43 audio_codecs.push_back( | |
| 44 cricket::AudioCodec(105, "CN", 16000, 0, 1, 0)); | |
| 45 return audio_codecs; | |
| 46 } | |
| 47 | |
| 48 std::vector<cricket::VideoCodec> RequiredVideoCodecs() { | |
| 49 std::vector<cricket::VideoCodec> video_codecs; | |
| 50 video_codecs.push_back( | |
| 51 cricket::VideoCodec(97, "H264", 320, 240, 30, 0)); | |
| 52 video_codecs.push_back( | |
| 53 cricket::VideoCodec(99, "H264-SVC", 640, 360, 30, 0)); | |
| 54 return video_codecs; | |
| 55 } | |
| 56 | |
| 57 cricket::MediaEngineInterface* MediaEngineFactory::CreateFileMediaEngine( | |
| 58 const char* voice_in, const char* voice_out, | |
| 59 const char* video_in, const char* video_out) { | |
| 60 cricket::FileMediaEngine* file_media_engine = new cricket::FileMediaEngine; | |
| 61 // Set the RTP dump file names. | |
| 62 if (voice_in) { | |
| 63 file_media_engine->set_voice_input_filename(voice_in); | |
| 64 } | |
| 65 if (voice_out) { | |
| 66 file_media_engine->set_voice_output_filename(voice_out); | |
| 67 } | |
| 68 if (video_in) { | |
| 69 file_media_engine->set_video_input_filename(video_in); | |
| 70 } | |
| 71 if (video_out) { | |
| 72 file_media_engine->set_video_output_filename(video_out); | |
| 73 } | |
| 74 | |
| 75 // Set voice and video codecs. TODO: The codecs actually depend on | |
| 76 // the the input voice and video streams. | |
| 77 file_media_engine->set_voice_codecs(RequiredAudioCodecs()); | |
| 78 file_media_engine->set_video_codecs(RequiredVideoCodecs()); | |
| 79 | |
| 80 return file_media_engine; | |
| 81 } | |
| OLD | NEW |