Changeset View
Changeset View
Standalone View
Standalone View
protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
Context not available. | |||||
60 | /////////////////////////////////////////////////////////////////////////// | 60 | /////////////////////////////////////////////////////////////////////////// | ||
---|---|---|---|---|---|
61 | LinphoneMediaEngine::LinphoneMediaEngine(const std::string& ringWav, const std::string& callWav) : ring_wav_(ringWav), call_wav_(callWav) { | 61 | LinphoneMediaEngine::LinphoneMediaEngine(const std::string& ringWav, const std::string& callWav) : ring_wav_(ringWav), call_wav_(callWav) { | ||
62 | ortp_init(); | 62 | ortp_init(); | ||
63 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
63 | ms_init(); | 64 | ms_init(); | ||
65 | #else | ||||
66 | factory = ms_factory_new(); | ||||
67 | ms_factory_init_voip(factory); | ||||
68 | ms_factory_init_plugins(factory); | ||||
69 | #endif | ||||
64 | 70 | | |||
65 | #ifndef WIN32 | 71 | #ifndef WIN32 | ||
66 | char * path = strdup(MSILBC_LIBRARY); | 72 | char * path = strdup(MSILBC_LIBRARY); | ||
67 | char * dirc = dirname(path); | 73 | char * dirc = dirname(path); | ||
74 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
68 | ms_load_plugins(dirc); | 75 | ms_load_plugins(dirc); | ||
76 | #else | ||||
77 | ms_factory_load_plugins(factory, dirc); | ||||
78 | #endif | ||||
69 | free(path); | 79 | free(path); | ||
70 | #endif | 80 | #endif | ||
71 | 81 | | |||
82 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
72 | have_ilbc = ms_filter_codec_supported("iLBC"); | 83 | have_ilbc = ms_filter_codec_supported("iLBC"); | ||
73 | have_speex = ms_filter_codec_supported("speex"); | 84 | have_speex = ms_filter_codec_supported("speex"); | ||
74 | have_gsm = ms_filter_codec_supported("gsm"); | 85 | have_gsm = ms_filter_codec_supported("gsm"); | ||
86 | #else | ||||
87 | have_ilbc = ms_factory_codec_supported(factory, "iLBC"); | ||||
88 | have_speex = ms_factory_codec_supported(factory, "speex"); | ||||
89 | have_gsm = ms_factory_codec_supported(factory, "gsm"); | ||||
90 | #endif | ||||
75 | 91 | | |||
76 | if (have_speex) { | 92 | if (have_speex) { | ||
77 | voice_codecs_.push_back(AudioCodec(110, payload_type_speex_wb.mime_type, payload_type_speex_wb.clock_rate, 0, 1, 8)); | 93 | voice_codecs_.push_back(AudioCodec(110, payload_type_speex_wb.mime_type, payload_type_speex_wb.clock_rate, 0, 1, 8)); | ||
Context not available. | |||||
88 | voice_codecs_.push_back(AudioCodec(101, payload_type_telephone_event.mime_type, payload_type_telephone_event.clock_rate, 0, 1, 1)); | 104 | voice_codecs_.push_back(AudioCodec(101, payload_type_telephone_event.mime_type, payload_type_telephone_event.clock_rate, 0, 1, 1)); | ||
89 | } | 105 | } | ||
90 | 106 | | |||
107 | LinphoneMediaEngine::~LinphoneMediaEngine() { | ||||
108 | #ifndef MEDIASTREAMER_LESS_2_14 | ||||
109 | ms_factory_uninit_plugins(factory); | ||||
110 | ms_factory_uninit_voip(factory); | ||||
111 | ms_factory_destroy(factory); | ||||
112 | #endif | ||||
113 | } | ||||
114 | | ||||
91 | void LinphoneMediaEngine::Terminate() { | 115 | void LinphoneMediaEngine::Terminate() { | ||
92 | fflush(stdout); | 116 | fflush(stdout); | ||
93 | } | 117 | } | ||
Context not available. | |||||
149 | playport2 = PORT_UNUSED; | 173 | playport2 = PORT_UNUSED; | ||
150 | 174 | | |||
151 | #ifdef _DEBUG | 175 | #ifdef _DEBUG | ||
152 | ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); | 176 | ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); | ||
153 | #else | 177 | #else | ||
154 | ortp_set_log_level_mask(ORTP_FATAL); | 178 | ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL); | ||
155 | #endif | 179 | #endif | ||
156 | 180 | | |||
157 | #ifdef MEDIASTREAMER_LESS_2_9 | 181 | #ifdef MEDIASTREAMER_LESS_2_9 | ||
158 | audio_stream_ = audio_stream_new(-1, 0); /* -1 means that function will choose some free port */ | 182 | audio_stream_ = audio_stream_new(-1, 0); /* -1 means that function will choose some free port */ | ||
159 | #else | 183 | #elseif MEDIASTREAMER_LESS_2_14 | ||
160 | audio_stream_ = audio_stream_new(-1, -1, 0); /* -1 means that function will choose some free port */ | 184 | audio_stream_ = audio_stream_new(-1, -1, 0); /* -1 means that function will choose some free port */ | ||
185 | #else | ||||
186 | audio_stream_ = audio_stream_new(engine_->factory, -1, -1, 0); /* -1 means that function will choose some free port */ | ||||
161 | #endif | 187 | #endif | ||
162 | 188 | | |||
163 | } | 189 | } | ||
Context not available. | |||||
272 | { | 298 | { | ||
273 | StopRing(); | 299 | StopRing(); | ||
274 | 300 | | |||
275 | MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get()); | 301 | #ifdef MEDIASTREAMER_LESS_2_14 | ||
302 | MSSndCardManager *snd_manager = ms_snd_card_manager_get(); | ||||
303 | #else | ||||
304 | MSSndCardManager *snd_manager = ms_factory_get_snd_card_manager(engine_->factory); | ||||
305 | #endif | ||||
306 | | ||||
307 | MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(snd_manager); | ||||
276 | if (!playcard) | 308 | if (!playcard) | ||
277 | return false; | 309 | return false; | ||
278 | 310 | | |||
279 | MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get()); | 311 | MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(snd_manager); | ||
280 | if (!captcard) | 312 | if (!captcard) | ||
281 | return false; | 313 | return false; | ||
282 | 314 | | |||
Context not available. | |||||
333 | 365 | | |||
334 | void LinphoneVoiceChannel::StartRing(bool bIncomingCall) | 366 | void LinphoneVoiceChannel::StartRing(bool bIncomingCall) | ||
335 | { | 367 | { | ||
368 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
369 | MSSndCardManager *snd_manager = ms_snd_card_manager_get(); | ||||
370 | #else | ||||
371 | MSSndCardManager *snd_manager = ms_factory_get_snd_card_manager(engine_->factory); | ||||
372 | #endif | ||||
373 | | ||||
336 | MSSndCard *sndcard = NULL; | 374 | MSSndCard *sndcard = NULL; | ||
337 | sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()); | 375 | sndcard=ms_snd_card_manager_get_default_card(snd_manager); | ||
338 | if (sndcard) | 376 | if (sndcard) | ||
339 | { | 377 | { | ||
340 | if (bIncomingCall) | 378 | if (bIncomingCall) | ||
Context not available. | |||||
342 | if (engine_->GetRingWav().size() > 0) | 380 | if (engine_->GetRingWav().size() > 0) | ||
343 | { | 381 | { | ||
344 | LOG(LS_VERBOSE) << "incoming ring. sound file: " << engine_->GetRingWav().c_str() << "\n"; | 382 | LOG(LS_VERBOSE) << "incoming ring. sound file: " << engine_->GetRingWav().c_str() << "\n"; | ||
383 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
345 | ring_stream_ = ring_start (engine_->GetRingWav().c_str(), 1, sndcard); | 384 | ring_stream_ = ring_start (engine_->GetRingWav().c_str(), 1, sndcard); | ||
385 | #else | ||||
386 | ring_stream_ = ring_start (engine_->factory, engine_->GetRingWav().c_str(), 1, sndcard); | ||||
387 | #endif | ||||
346 | } | 388 | } | ||
347 | } | 389 | } | ||
348 | else | 390 | else | ||
Context not available. | |||||
350 | if (engine_->GetCallWav().size() > 0) | 392 | if (engine_->GetCallWav().size() > 0) | ||
351 | { | 393 | { | ||
352 | LOG(LS_VERBOSE) << "outgoing ring. sound file: " << engine_->GetCallWav().c_str() << "\n"; | 394 | LOG(LS_VERBOSE) << "outgoing ring. sound file: " << engine_->GetCallWav().c_str() << "\n"; | ||
395 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
353 | ring_stream_ = ring_start (engine_->GetCallWav().c_str(), 1, sndcard); | 396 | ring_stream_ = ring_start (engine_->GetCallWav().c_str(), 1, sndcard); | ||
397 | #else | ||||
398 | ring_stream_ = ring_start (engine_->factory, engine_->GetCallWav().c_str(), 1, sndcard); | ||||
399 | #endif | ||||
354 | } | 400 | } | ||
355 | } | 401 | } | ||
356 | } | 402 | } | ||
Context not available. |