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 | #ifndef MEDIASTREAMER_LESS_2_14 | ||||
108 | LinphoneMediaEngine::~LinphoneMediaEngine() { | ||||
109 | ms_factory_uninit_plugins(factory); | ||||
110 | ms_factory_uninit_voip(factory); | ||||
111 | ms_factory_destroy(factory); | ||||
112 | } | ||||
113 | #endif | ||||
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 | ||
176 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
152 | ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); | 177 | ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); | ||
153 | #else | 178 | #else | ||
179 | ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); | ||||
180 | #endif | ||||
181 | #else | ||||
182 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
154 | ortp_set_log_level_mask(ORTP_FATAL); | 183 | ortp_set_log_level_mask(ORTP_FATAL); | ||
184 | #else | ||||
185 | ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL); | ||||
186 | #endif | ||||
155 | #endif | 187 | #endif | ||
156 | 188 | | |||
157 | #ifdef MEDIASTREAMER_LESS_2_9 | 189 | #ifdef MEDIASTREAMER_LESS_2_9 | ||
158 | audio_stream_ = audio_stream_new(-1, 0); /* -1 means that function will choose some free port */ | 190 | audio_stream_ = audio_stream_new(-1, 0); /* -1 means that function will choose some free port */ | ||
159 | #else | 191 | #elif MEDIASTREAMER_LESS_2_14 | ||
160 | audio_stream_ = audio_stream_new(-1, -1, 0); /* -1 means that function will choose some free port */ | 192 | audio_stream_ = audio_stream_new(-1, -1, 0); /* -1 means that function will choose some free port */ | ||
193 | #else | ||||
194 | audio_stream_ = audio_stream_new(engine_->factory, -1, -1, 0); /* -1 means that function will choose some free port */ | ||||
161 | #endif | 195 | #endif | ||
162 | 196 | | |||
163 | } | 197 | } | ||
Context not available. | |||||
272 | { | 306 | { | ||
273 | StopRing(); | 307 | StopRing(); | ||
274 | 308 | | |||
309 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
310 | MSSndCardManager *snd_manager = ms_snd_card_manager_get(); | ||||
275 | MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get()); | 311 | MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get()); | ||
312 | #else | ||||
313 | MSSndCardManager *snd_manager = ms_factory_get_snd_card_manager(engine_->factory); | ||||
314 | MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(snd_manager); | ||||
315 | #endif | ||||
316 | | ||||
276 | if (!playcard) | 317 | if (!playcard) | ||
277 | return false; | 318 | return false; | ||
278 | 319 | | |||
320 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
279 | MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get()); | 321 | MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get()); | ||
322 | #else | ||||
323 | MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(snd_manager); | ||||
324 | #endif | ||||
280 | if (!captcard) | 325 | if (!captcard) | ||
281 | return false; | 326 | return false; | ||
282 | 327 | | |||
Context not available. | |||||
333 | 378 | | |||
334 | void LinphoneVoiceChannel::StartRing(bool bIncomingCall) | 379 | void LinphoneVoiceChannel::StartRing(bool bIncomingCall) | ||
335 | { | 380 | { | ||
381 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
382 | MSSndCardManager *snd_manager = ms_snd_card_manager_get(); | ||||
383 | #else | ||||
384 | MSSndCardManager *snd_manager = ms_factory_get_snd_card_manager(engine_->factory); | ||||
385 | #endif | ||||
386 | | ||||
336 | MSSndCard *sndcard = NULL; | 387 | MSSndCard *sndcard = NULL; | ||
388 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
337 | sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()); | 389 | sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()); | ||
390 | #else | ||||
391 | sndcard=ms_snd_card_manager_get_default_card(snd_manager); | ||||
392 | #endif | ||||
338 | if (sndcard) | 393 | if (sndcard) | ||
339 | { | 394 | { | ||
340 | if (bIncomingCall) | 395 | if (bIncomingCall) | ||
Context not available. | |||||
342 | if (engine_->GetRingWav().size() > 0) | 397 | if (engine_->GetRingWav().size() > 0) | ||
343 | { | 398 | { | ||
344 | LOG(LS_VERBOSE) << "incoming ring. sound file: " << engine_->GetRingWav().c_str() << "\n"; | 399 | LOG(LS_VERBOSE) << "incoming ring. sound file: " << engine_->GetRingWav().c_str() << "\n"; | ||
400 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
345 | ring_stream_ = ring_start (engine_->GetRingWav().c_str(), 1, sndcard); | 401 | ring_stream_ = ring_start (engine_->GetRingWav().c_str(), 1, sndcard); | ||
402 | #else | ||||
403 | ring_stream_ = ring_start (engine_->factory, engine_->GetRingWav().c_str(), 1, sndcard); | ||||
404 | #endif | ||||
346 | } | 405 | } | ||
347 | } | 406 | } | ||
348 | else | 407 | else | ||
Context not available. | |||||
350 | if (engine_->GetCallWav().size() > 0) | 409 | if (engine_->GetCallWav().size() > 0) | ||
351 | { | 410 | { | ||
352 | LOG(LS_VERBOSE) << "outgoing ring. sound file: " << engine_->GetCallWav().c_str() << "\n"; | 411 | LOG(LS_VERBOSE) << "outgoing ring. sound file: " << engine_->GetCallWav().c_str() << "\n"; | ||
412 | #ifdef MEDIASTREAMER_LESS_2_14 | ||||
353 | ring_stream_ = ring_start (engine_->GetCallWav().c_str(), 1, sndcard); | 413 | ring_stream_ = ring_start (engine_->GetCallWav().c_str(), 1, sndcard); | ||
414 | #else | ||||
415 | ring_stream_ = ring_start (engine_->factory, engine_->GetCallWav().c_str(), 1, sndcard); | ||||
416 | #endif | ||||
354 | } | 417 | } | ||
355 | } | 418 | } | ||
356 | } | 419 | } | ||
Context not available. |