Commit c50b270e authored by Sandrine Avakian's avatar Sandrine Avakian

First changes to have the LinphoneCore instance own the factory object instead...

First changes to have the LinphoneCore instance own the factory object instead of sharing  it through a static variable.
parent a6a954f7
......@@ -410,9 +410,10 @@ typedef struct _AudioStream AudioStream;
/* start a thread that does sampling->encoding->rtp_sending|rtp_receiving->decoding->playing */
MS2_PUBLIC AudioStream *audio_stream_start (RtpProfile * prof, int locport, const char *remip,
int remport, int payload_type, int jitt_comp, bool_t echo_cancel);
int remport, int payload_type, int jitt_comp, bool_t echo_cancel, MSFactory* factory);
MS2_PUBLIC AudioStream *audio_stream_start_with_sndcards(RtpProfile * prof, int locport, const char *remip4, int remport, int payload_type, int jitt_comp, MSSndCard *playcard, MSSndCard *captcard, bool_t echocancel);
MS2_PUBLIC AudioStream *audio_stream_start_with_sndcards(RtpProfile* prof, int locport, const char *remip4, int remport, int payload_type, int jitt_comp, MSSndCard *playcard,
MSSndCard *captcard, bool_t echocancel, MSFactory* factory);
MS2_PUBLIC int audio_stream_start_with_files (AudioStream * stream, RtpProfile * prof,
const char *remip, int remport, int rem_rtcp_port,
......@@ -475,25 +476,28 @@ MS2_PUBLIC void audio_stream_play_received_dtmfs(AudioStream *st, bool_t yesno);
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param ipv6 TRUE if ipv6 must be used.
* @param factory
* @return a new AudioStream.
**/
MS2_PUBLIC AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
MS2_PUBLIC AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6, MSFactory* factory);
/**
* Creates an AudioStream object listening on a RTP port for a dedicated address.
* @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param factory
* @return a new AudioStream.
**/
MS2_PUBLIC AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port);
MS2_PUBLIC AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port, MSFactory* factory);
/**Creates an AudioStream object from initialized MSMediaStreamSessions.
* @param sessions the MSMediaStreamSessions
* @param factory the MSFActory from the core object
* @return a new AudioStream
**/
MS2_PUBLIC AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions);
MS2_PUBLIC AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions, MSFactory* factory);
#define AUDIO_STREAM_FEATURE_PLC (1 << 0)
#define AUDIO_STREAM_FEATURE_EC (1 << 1)
......
......@@ -28,6 +28,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "TargetConditionals.h"
#endif
#ifndef LINPHONE_DEPRECATED
#if defined(_MSC_VER)
#define LINPHONE_DEPRECATED __declspec(deprecated)
#else
#define LINPHONE_DEPRECATED __attribute__ ((deprecated))
#endif
#endif
#define MS_UNUSED(x) ((void)(x))
#define ms_malloc ortp_malloc
......@@ -337,14 +344,14 @@ MS2_PUBLIC bool_t ms_tags_list_contains_tag(const MSList *list, const char *tag)
*
* This must be called once before calling any other API.
*/
MS2_PUBLIC void ms_base_init(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_base_init(void);
/**
* Initialize the mediastreamer2 VoIP library.
*
* This must be called one before calling any other API.
*/
MS2_PUBLIC void ms_voip_init(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_voip_init(void);
/**
* Load the plugins from the default plugin directory.
......@@ -352,13 +359,13 @@ MS2_PUBLIC void ms_voip_init(void);
* This is just a wrapper around ms_load_plugins().
* This must be called after ms_base_init() and after ms_voip_init().
*/
MS2_PUBLIC void ms_plugins_init(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_plugins_init(void);
/**
* Set the directory from where the plugins are to be loaded when calling ms_plugins_init().
* @param[in] path The path to the plugins directory.
*/
MS2_PUBLIC void ms_set_plugins_dir(const char *path);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_plugins_dir(const char *path);
/**
* Load plugins from a specific directory.
......@@ -371,26 +378,26 @@ MS2_PUBLIC void ms_set_plugins_dir(const char *path);
*
* Returns: >0 if successfull, 0 if not plugins loaded, -1 otherwise.
*/
MS2_PUBLIC int ms_load_plugins(const char *directory);
MS2_PUBLIC LINPHONE_DEPRECATED int ms_load_plugins(const char *directory);
/**
* Release resource allocated in the mediastreamer2 base library.
*
* This must be called once before closing program.
*/
MS2_PUBLIC void ms_base_exit(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_base_exit(void);
/**
* Release resource allocated in the mediastreamer2 VoIP library.
*
* This must be called once before closing program.
*/
MS2_PUBLIC void ms_voip_exit(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_voip_exit(void);
/**
* Unload the plugins loaded by ms_plugins_init().
*/
MS2_PUBLIC void ms_plugins_exit(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_plugins_exit(void);
struct _MSSndCardDesc;
......@@ -407,9 +414,9 @@ MS2_PUBLIC void ms_usleep(uint64_t usec);
* value works for both.
*
**/
MS2_PUBLIC int ms_get_payload_max_size(void);
MS2_PUBLIC LINPHONE_DEPRECATED int ms_get_payload_max_size(void);
MS2_PUBLIC void ms_set_payload_max_size(int size);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_payload_max_size(int size);
/**
* Returns the network Max Transmission Unit to reach destination_host.
......@@ -433,9 +440,9 @@ MS2_PUBLIC int ms_get_mtu(void);
/**
* Declare how many cpu (cores) are available on the platform
*/
MS2_PUBLIC void ms_set_cpu_count(unsigned int c);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_cpu_count(unsigned int c);
MS2_PUBLIC unsigned int ms_get_cpu_count(void);
MS2_PUBLIC LINPHONE_DEPRECATED unsigned int ms_get_cpu_count(void);
/**
* Adds a new entry in the SoundDeviceDescription table
......
......@@ -75,9 +75,10 @@ extern "C" {
/**
* Creates a conference.
* @param params a MSAudioConferenceParams structure, containing conference parameters.
* @param factory a MSFactory structure, containing filters parameters
* @return a MSAudioConference object.
**/
MS2_PUBLIC MSAudioConference * ms_audio_conference_new(const MSAudioConferenceParams *params);
MS2_PUBLIC MSAudioConference * ms_audio_conference_new(const MSAudioConferenceParams *params, MSFactory *factory);
/**
* Gets conference's current parameters.
......
......@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define mseventqueue_h
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msfactory.h>
typedef struct _MSEventQueue MSEventQueue;
......@@ -40,7 +41,7 @@ MS2_PUBLIC MSEventQueue *ms_event_queue_new(void);
* to the event queue.
*
**/
MS2_PUBLIC void ms_set_global_event_queue(MSEventQueue *q);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_global_event_queue(MSEventQueue *q);
/**
* Run callbacks associated to the events received.
......@@ -58,6 +59,6 @@ MS2_PUBLIC void ms_event_queue_skip(MSEventQueue *q);
/**
* Destroys an event queue.
**/
MS2_PUBLIC void ms_event_queue_destroy(MSEventQueue *q);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_event_queue_destroy(MSEventQueue *q);
MS2_PUBLIC void ms_event_queue_destroy(MSEventQueue *q, MSFactory *f);
#endif
......@@ -46,6 +46,14 @@ typedef struct _MSFactory MSFactory;
extern "C" {
#endif
#ifndef LINPHONE_DEPRECATED
#if defined(_MSC_VER)
#define LINPHONE_DEPRECATED __declspec(deprecated)
#else
#define LINPHONE_DEPRECATED __attribute__ ((deprecated))
#endif
#endif
/**
* Create a mediastreamer2 factory. This is the root object that will create everything else from mediastreamer2.
**/
......@@ -54,13 +62,13 @@ MS2_PUBLIC MSFactory *ms_factory_new(void);
/**
* Create the fallback factory (for compatibility with applications not using MSFactory to create ms2 object)
**/
MS2_PUBLIC MSFactory *ms_factory_create_fallback(void);
LINPHONE_DEPRECATED MS2_PUBLIC MSFactory *ms_factory_create_fallback(void);
/**
* Used by the legacy functions before MSFactory was added.
* Do not use in an application.
**/
MS2_PUBLIC MSFactory *ms_factory_get_fallback(void);
LINPHONE_DEPRECATED MS2_PUBLIC MSFactory *ms_factory_get_fallback(void);
/**
* Destroy the factory.
......
......@@ -243,7 +243,7 @@ extern "C"{
*
* @param desc a filter description.
*/
MS2_PUBLIC void ms_filter_register(MSFilterDesc *desc);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_register(MSFilterDesc *desc);
/**
* Retrieve capture filter that supports encoding to codec name.
......@@ -252,7 +252,7 @@ MS2_PUBLIC void ms_filter_register(MSFilterDesc *desc);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime);
/**
* Retrieve render filter that supports decoding to codec name.
......@@ -261,7 +261,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_decoding_renderer(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_decoding_renderer(const char *mime);
/**
* Retrieve encoders according to codec name.
......@@ -275,7 +275,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_decoding_renderer(const char *mime);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_encoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_encoder(const char *mime);
/**
* Retrieve decoders according to codec name.
......@@ -289,7 +289,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_encoder(const char *mime);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_decoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_decoder(const char *mime);
/**
* Lookup a mediastreamer2 filter using its name.
......@@ -299,7 +299,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_decoder(const char *mime);
*
* @param filter_name The filter name.
**/
MS2_PUBLIC MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
/**
* Returns a list of filter descriptions implementing a given interface.
......@@ -307,7 +307,7 @@ MS2_PUBLIC MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
* @param id a filter interface id
* @return a newly allocated MSList of #MSFilterDesc.
**/
MS2_PUBLIC MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
MS2_PUBLIC LINPHONE_DEPRECATED MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
/**
* Create encoder filter according to codec name.
......@@ -321,7 +321,7 @@ MS2_PUBLIC MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter * ms_filter_create_encoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter * ms_filter_create_encoder(const char *mime);
/**
* Create decoder filter according to codec name.
......@@ -335,7 +335,7 @@ MS2_PUBLIC MSFilter * ms_filter_create_encoder(const char *mime);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter * ms_filter_create_decoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter * ms_filter_create_decoder(const char *mime);
/**
* Check if a encode or decode filter exists for a codec name.
......@@ -349,7 +349,7 @@ MS2_PUBLIC MSFilter * ms_filter_create_decoder(const char *mime);
*
* Returns: TRUE if successfull, FALSE otherwise.
*/
MS2_PUBLIC bool_t ms_filter_codec_supported(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED bool_t ms_filter_codec_supported(const char *mime);
/**
* Create decoder filter according to a filter's MSFilterId.
......@@ -358,7 +358,7 @@ MS2_PUBLIC bool_t ms_filter_codec_supported(const char *mime);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter *ms_filter_new(MSFilterId id);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter *ms_filter_new(MSFilterId id);
/**
* Create decoder filter according to a filter's name.
......@@ -367,7 +367,7 @@ MS2_PUBLIC MSFilter *ms_filter_new(MSFilterId id);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter *ms_filter_new_from_name(const char *name);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter *ms_filter_new_from_name(const char *name);
/**
* Create decoder filter according to a filter's description.
......@@ -379,7 +379,7 @@ MS2_PUBLIC MSFilter *ms_filter_new_from_name(const char *name);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter *ms_filter_new_from_desc(MSFilterDesc *desc);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter *ms_filter_new_from_desc(MSFilterDesc *desc);
/**
* Link one OUTPUT pin from a filter to an INPUT pin of another filter.
......@@ -587,26 +587,26 @@ MS2_PUBLIC int ms_connection_helper_unlink(MSConnectionHelper *h, MSFilter *f, i
* \brief Enable processing time measurements statistics for filters.
*
**/
MS2_PUBLIC void ms_filter_enable_statistics(bool_t enabled);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_enable_statistics(bool_t enabled);
/**
* \brief Reset processing time statistics for filters.
*
**/
MS2_PUBLIC void ms_filter_reset_statistics(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_reset_statistics(void);
/**
* \brief Retrieves statistics for running filters.
* Returns a list of MSFilterStats
**/
MS2_PUBLIC const MSList * ms_filter_get_statistics(void);
MS2_PUBLIC LINPHONE_DEPRECATED const MSList * ms_filter_get_statistics(void);
/**
* \brief Logs runtime statistics for running filters.
*
**/
MS2_PUBLIC void ms_filter_log_statistics(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_log_statistics(void);
......
......@@ -196,6 +196,15 @@ void ms_event_queue_destroy(MSEventQueue *q){
ms_free(q);
}
void ms_event_queue_destroy(MSEventQueue *q, MSFactory *f){
/*compatibility code*/
if (q==ms_factory_get_event_queue(f)){
ms_factory_set_event_queue(f,NULL);
}
ms_mutex_destroy(&q->mutex);
ms_free(q);
}
void ms_set_global_event_queue(MSEventQueue *q){
ms_factory_set_event_queue(ms_factory_get_fallback(),q);
}
......
......@@ -310,7 +310,7 @@ static int ms_plugins_ref=0;
void ms_base_init(){
ms_base_ref++;
if ( ms_base_ref>1 ) {
ms_message ("Skiping ms_base_init, because [%i] ref",ms_base_ref);
ms_message ("Skipping ms_base_init, because [%i] ref",ms_base_ref);
return;
}
ms_factory_create_fallback();
......@@ -320,7 +320,7 @@ void ms_base_init(){
void ms_base_exit(){
--ms_base_ref;
if ( ms_base_ref>0 ) {
ms_message ("Skiping ms_base_exit, still [%i] ref",ms_base_ref);
ms_message ("Skipping ms_base_exit, still [%i] ref",ms_base_ref);
return;
}
ms_factory_destroy(ms_factory_get_fallback());
......@@ -329,7 +329,7 @@ void ms_base_exit(){
void ms_plugins_init(void) {
ms_plugins_ref++;
if ( ms_plugins_ref>1 ) {
ms_message ("Skiping ms_plugins_init, because [%i] ref",ms_plugins_ref);
ms_message ("Skipping ms_plugins_init, because [%i] ref",ms_plugins_ref);
return;
}
ms_factory_init_plugins(ms_factory_get_fallback());
......@@ -338,7 +338,7 @@ void ms_plugins_init(void) {
void ms_plugins_exit(void) {
--ms_plugins_ref;
if ( ms_plugins_ref>0 ) {
ms_message ("Skiping ms_plugins_exit, still [%i] ref",ms_plugins_ref);
ms_message ("Skipping ms_plugins_exit, still [%i] ref",ms_plugins_ref);
return;
}
ms_factory_uninit_plugins(ms_factory_get_fallback());
......
......@@ -64,7 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
static MSFactory *fallback_factory=NULL;
LINPHONE_DEPRECATED static MSFactory *fallback_factory=NULL;
static void ms_fmt_descriptor_destroy(MSFmtDescriptor *obj);
......@@ -246,7 +246,7 @@ MSFactory *ms_factory_new(void){
**/
void ms_factory_destroy(MSFactory *factory){
ms_factory_uninit_plugins(factory);
if (factory->evq) ms_event_queue_destroy(factory->evq);
if (factory->evq) ms_event_queue_destroy(factory->evq, factory);
factory->formats=ms_list_free_with_data(factory->formats,(void(*)(void*))ms_fmt_descriptor_destroy);
factory->desc_list=ms_list_free(factory->desc_list);
ms_list_for_each(factory->stats_list,ms_free);
......@@ -256,7 +256,7 @@ void ms_factory_destroy(MSFactory *factory){
factory->platform_tags = ms_list_free(factory->platform_tags);
if (factory->plugins_dir) ms_free(factory->plugins_dir);
ms_free(factory);
if (factory==fallback_factory) fallback_factory=NULL;
//if (factory==fallback_factory) fallback_factory=NULL;
}
......
......@@ -232,7 +232,7 @@ static void enc_init(MSFilter *f, enum CodecID codec)
s->framenum=0;
s->av_context.codec=NULL;
s->vconf_list = get_vconf_list(s);
s->vconf = ms_video_find_best_configuration_for_bitrate(s->vconf_list, 500000, ms_get_cpu_count());
s->vconf = ms_video_find_best_configuration_for_bitrate(s->vconf_list, 500000,ms_factory_get_cpu_count(f->factory));
s->pict = av_frame_alloc();
}
......@@ -910,7 +910,7 @@ static int enc_set_vsize(MSFilter *f, void *arg) {
MSVideoConfiguration best_vconf;
MSVideoSize *vs = (MSVideoSize *)arg;
EncState *s=(EncState*)f->data;
best_vconf = ms_video_find_best_configuration_for_size(s->vconf_list, *vs, ms_get_cpu_count());
best_vconf = ms_video_find_best_configuration_for_size(s->vconf_list, *vs, ms_factory_get_cpu_count(f->factory));
s->vconf.vsize = *vs;
s->vconf.fps = best_vconf.fps;
s->vconf.bitrate_limit = best_vconf.bitrate_limit;
......@@ -944,7 +944,7 @@ static int enc_set_br(MSFilter *f, void *arg) {
s->vconf.required_bitrate = br;
enc_set_configuration(f, &s->vconf);
} else {
MSVideoConfiguration best_vconf = ms_video_find_best_configuration_for_bitrate(s->vconf_list, br, ms_get_cpu_count());
MSVideoConfiguration best_vconf = ms_video_find_best_configuration_for_bitrate(s->vconf_list, br, ms_factory_get_cpu_count(f->factory));
enc_set_configuration(f, &best_vconf);
}
return 0;
......
......@@ -46,13 +46,14 @@ struct _MSAudioEndpoint{
MSAudioConference * ms_audio_conference_new(const MSAudioConferenceParams *params){
MSAudioConference * ms_audio_conference_new(const MSAudioConferenceParams *params, MSFactory* factory){
MSAudioConference *obj=ms_new0(MSAudioConference,1);
int tmp=1;
obj->ticker=ms_ticker_new();
ms_ticker_set_name(obj->ticker,"Audio conference MSTicker");
ms_ticker_set_priority(obj->ticker,__ms_get_default_prio(FALSE));
obj->mixer=ms_filter_new(MS_AUDIO_MIXER_ID);
obj->mixer = ms_factory_create_filter(factory, MS_AUDIO_MIXER_ID);
//obj->mixer=ms_filter_new(MS_AUDIO_MIXER_ID);
obj->params=*params;
ms_filter_call_method(obj->mixer,MS_AUDIO_MIXER_ENABLE_CONFERENCE_MODE,&tmp);
ms_filter_call_method(obj->mixer,MS_FILTER_SET_SAMPLE_RATE,&obj->params.samplerate);
......
......@@ -136,7 +136,8 @@ static bool_t audio_stream_payload_type_changed(RtpSession *session, void *data)
return FALSE;
}
dec = ms_filter_create_decoder(pt->mime_type);
//dec = ms_filter_create_decoder(pt->mime_type);
dec = ms_factory_create_decoder(stream->ms.factory, pt->mime_type);
if (dec != NULL) {
MSFilter *nextFilter = stream->ms.decoder->outputs[0]->next.filter;
......@@ -1197,7 +1198,7 @@ int audio_stream_start_with_files(AudioStream *stream, RtpProfile *prof,const ch
return audio_stream_start_full(stream,prof,remip,remport,remip,rem_rtcp_port,pt,jitt_comp,infile,outfile,NULL,NULL,FALSE);
}
AudioStream * audio_stream_start(RtpProfile *prof,int locport,const char *remip,int remport,int profile,int jitt_comp,bool_t use_ec)
AudioStream *audio_stream_start(RtpProfile *prof,int locport,const char *remip,int remport,int profile,int jitt_comp,bool_t use_ec, MSFactory* factory)
{
MSSndCard *sndcard_playback;
MSSndCard *sndcard_capture;
......@@ -1206,13 +1207,13 @@ AudioStream * audio_stream_start(RtpProfile *prof,int locport,const char *remip,
sndcard_playback=ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
if (sndcard_capture==NULL || sndcard_playback==NULL)
return NULL;
stream=audio_stream_new(locport, locport+1, ms_is_ipv6(remip));
stream=audio_stream_new(locport, locport+1, ms_is_ipv6(remip),factory);
if (audio_stream_start_full(stream,prof,remip,remport,remip,remport+1,profile,jitt_comp,NULL,NULL,sndcard_playback,sndcard_capture,use_ec)==0) return stream;
audio_stream_free(stream);
return NULL;
}
AudioStream *audio_stream_start_with_sndcards(RtpProfile *prof,int locport,const char *remip,int remport,int profile,int jitt_comp,MSSndCard *playcard, MSSndCard *captcard, bool_t use_ec)
AudioStream *audio_stream_start_with_sndcards(RtpProfile *prof,int locport,const char *remip,int remport,int profile,int jitt_comp,MSSndCard *playcard, MSSndCard *captcard, bool_t use_ec, MSFactory* factory)
{
AudioStream *stream;
if (playcard==NULL) {
......@@ -1223,7 +1224,7 @@ AudioStream *audio_stream_start_with_sndcards(RtpProfile *prof,int locport,const
ms_error("No capture card.");
return NULL;
}
stream=audio_stream_new(locport, locport+1, ms_is_ipv6(remip));
stream=audio_stream_new(locport, locport+1, ms_is_ipv6(remip), factory);
if (audio_stream_start_full(stream,prof,remip,remport,remip,remport+1,profile,jitt_comp,NULL,NULL,playcard,captcard,use_ec)==0) return stream;
audio_stream_free(stream);
return NULL;
......@@ -1345,7 +1346,7 @@ void audio_stream_set_features(AudioStream *st, uint32_t features){
st->features = features;
}
AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions){
AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions, MSFactory *factory){
AudioStream *stream=(AudioStream *)ms_new0(AudioStream,1);
MSFilterDesc *ec_desc=ms_filter_lookup_by_name("MSWebRTCAEC");
const OrtpRtcpXrMediaCallbacks rtcp_xr_media_cbs = {
......@@ -1359,8 +1360,10 @@ AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *session
stream->ms.type = MSAudio;
stream->ms.sessions = *sessions;
media_stream_init(&stream->ms, ms_factory_get_fallback());
media_stream_init(&stream->ms,factory);
// media_stream_init(&stream->ms, ms_factory_get_fallback());
ms_filter_enable_statistics(TRUE);
ms_filter_reset_statistics();
......@@ -1393,15 +1396,15 @@ AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *session
return stream;
}
AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6){
return audio_stream_new2( ipv6 ? "::" : "0.0.0.0", loc_rtp_port, loc_rtcp_port);
AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6, MSFactory* factory){
return audio_stream_new2( ipv6 ? "::" : "0.0.0.0", loc_rtp_port, loc_rtcp_port, factory);
}
AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port) {
AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port, MSFactory* factory) {
AudioStream *obj;
MSMediaStreamSessions sessions={0};
sessions.rtp_session=ms_create_duplex_rtp_session(ip,loc_rtp_port,loc_rtcp_port);
obj=audio_stream_new_with_sessions(&sessions);
obj=audio_stream_new_with_sessions(&sessions, factory);
obj->ms.owns_sessions=TRUE;
return obj;
}
......
......@@ -295,8 +295,8 @@ VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *session
stream->ms.type = MSVideo;
stream->ms.sessions=*sessions;
media_stream_init(&stream->ms, ms_factory_get_fallback());
//media_stream_init(&stream->ms, ms_factory_get_fallback());
media_stream_init(&stream->ms, stream->ms.factory);
if (sessions->zrtp_context != NULL) {
ms_zrtp_set_stream_sessions(sessions->zrtp_context, &(stream->ms.sessions));
}
......
......@@ -912,7 +912,8 @@ void setup_media_streams(MediastreamDatas* args) {
const char* nowebcam = [[myBundle pathForResource:@"nowebcamCIF"ofType:@"jpg"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
ms_static_image_set_default_image(nowebcam);
NSUInteger cpucount = [[NSProcessInfo processInfo] processorCount];
ms_set_cpu_count(cpucount);
ms_factory_set_cpu_count(args->audio->ms.factory, cpucount);
//ms_set_cpu_count(cpucount);
#endif
video_stream_set_event_callback(args->video,video_stream_event_cb, args);
video_stream_set_freeze_on_error(args->video,args->freeze_on_error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment