linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] couple of patches for alsa capture and memory leak


From: Stephen Brooks
Subject: [Linphone-developers] couple of patches for alsa capture and memory leaks
Date: Mon, 22 Jan 2007 12:18:22 +0000
User-agent: Thunderbird 1.5.0.9 (X11/20070104)

Hi,

        Please find attached 3 patch files against linphone-1.3.4 in order :-

1) linphone_alsa_capture_fix_vanilla.patch
Use correct ALSA api call to get capture level range (was using playback equivalent resulting in capture level being set to 0 regardless of config file setting).

2) linphone_memfix_mediastreamer.patch
This fixes a number of leaks in the mediastreamer library which I understand has now been replaced by mediastreamer2 but including since it may be of use to others.

3) linphone_memfix_other.patch
Fixes a memory leak in eXosip and 2 in coreapi.

Best Regards,
--
Stephen Brooks <address@hidden>      Digital Depot, Thomas Street
Senior Software Engineer                            Dublin 8, Ireland
Lincor Solutions Ltd.                          Ph: +353 (0) 1 4893683
--- linphone-1.3.4/mediastreamer/alsacard.c.fix 2007-01-19 15:45:57.000000000 
+0000
+++ linphone-1.3.4/mediastreamer/alsacard.c     2007-01-19 15:47:26.000000000 
+0000
@@ -408,9 +408,9 @@
        const char *elemname;
        snd_mixer_elem_t *elem;
        int err;
-       long sndMixerPMin;
-       long sndMixerPMax;
-       long newvol;
+       long sndMixerPMin = 0;
+       long sndMixerPMax = 0;
+       long newvol = 0;
        elem=snd_mixer_first_elem(mixer);
        while (elem!=NULL){
                elemname=snd_mixer_selem_get_name(elem);
@@ -419,7 +419,7 @@
                        switch (action){
                                case CAPTURE:
                                if (snd_mixer_selem_has_capture_volume(elem)){
-                                       
snd_mixer_selem_get_playback_volume_range(elem, &sndMixerPMin, &sndMixerPMax);
+                                       
snd_mixer_selem_get_capture_volume_range(elem, &sndMixerPMin, &sndMixerPMax);
                                        
err=snd_mixer_selem_get_capture_volume(elem,SND_MIXER_SCHN_UNKNOWN,&newvol);
                                        newvol-=sndMixerPMin;
                                        
value=(100*newvol)/(sndMixerPMax-sndMixerPMin);
@@ -457,9 +457,9 @@
 static void set_mixer_element(snd_mixer_t *mixer,const char *name, gint 
level,MixerAction action){
        const char *elemname;
        snd_mixer_elem_t *elem;
-       long sndMixerPMin;
-       long sndMixerPMax;
-       long newvol;
+       long sndMixerPMin = 0;
+       long sndMixerPMax = 0;
+       long newvol = 0;
        
        elem=snd_mixer_first_elem(mixer);
        
@@ -470,7 +470,7 @@
                        switch(action){
                                case CAPTURE:
                                if (snd_mixer_selem_has_capture_volume(elem)){
-                                       
snd_mixer_selem_get_playback_volume_range(elem, &sndMixerPMin, &sndMixerPMax);
+                                       
snd_mixer_selem_get_capture_volume_range(elem, &sndMixerPMin, &sndMixerPMax);
                                        
newvol=(((sndMixerPMax-sndMixerPMin)*level)/100)+sndMixerPMin;
                                        
snd_mixer_selem_set_capture_volume_all(elem,newvol);
                                        //g_message("Succesfully set capture 
level for %s.",elemname);
--- linphone-1.3.4.3pcclevel/mediastreamer/audiostream.c.fix    2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/audiostream.c        2007-01-03 
09:29:11.000000000 +0000
@@ -278,7 +278,7 @@
        ms_filter_remove_links(stream->encoder,stream->rtpsend);
        ms_filter_remove_links(stream->rtprecv,stream->decoder);
        ms_filter_remove_links(stream->decoder,stream->soundwrite);
-       
+       g_thread_join(stream->timer->thread);   
        audio_stream_free(stream);
 }
 
@@ -296,6 +296,7 @@
        stream->source=ms_ring_player_new(file,interval);
        if (stream->source==NULL) {
                g_warning("Could not create ring player. Probably the ring file 
(%s) does not exist.",file);
+               g_free(stream);
                return NULL;
        }
   if (func!=NULL) 
ms_filter_set_notify_func(MS_FILTER(stream->source),func,user_data);
@@ -315,6 +316,7 @@
 {
        ms_stop(stream->timer);
        ms_sync_detach(stream->timer,stream->source);
+       g_thread_join(stream->timer->thread);
        ms_sync_destroy(stream->timer);
        ms_filter_remove_links(stream->source,stream->sndwrite);
        ms_filter_destroy(stream->source);
--- linphone-1.3.4.3pcclevel/mediastreamer/ms.c.fix     2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/ms.c 2007-01-03 09:29:11.000000000 
+0000
@@ -219,7 +219,6 @@
                }
                g_mutex_lock(sync->lock);
                sync->run=0;
-               sync->thread=NULL;
                g_cond_wait(sync->stop_cond,sync->lock);
                g_mutex_unlock(sync->lock);
        }
@@ -265,6 +264,7 @@
 {
        ms_thread_stop(sync);
        ms_sync_unsetup(sync);
+       ms_sync_uninit(sync);
 }
 
 
--- linphone-1.3.4.3pcclevel/mediastreamer/msGSMdecoder.c.fix   2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msGSMdecoder.c       2007-01-03 
09:29:11.000000000 +0000
@@ -112,5 +112,6 @@
 void ms_GSMdecoder_destroy( MSGSMDecoder *obj)
 {
        ms_GSMdecoder_uninit(obj);
+       g_mutex_free(obj->filter.lock);
        g_free(obj);
 }
--- linphone-1.3.4.3pcclevel/mediastreamer/msGSMencoder.c.fix   2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msGSMencoder.c       2007-01-03 
09:29:11.000000000 +0000
@@ -94,5 +94,6 @@
 void ms_GSMencoder_destroy( MSGSMEncoder *obj)
 {
        ms_GSMencoder_uninit(obj);
+       g_mutex_free(obj->filter.lock);
        g_free(obj);
 }
--- linphone-1.3.4.3pcclevel/mediastreamer/msMUlawdec.c.fix     2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msMUlawdec.c 2007-01-03 
09:29:11.000000000 +0000
@@ -126,5 +126,6 @@
 
 void ms_MULAWdecoder_destroy( MSMULAWDecoder *obj)
 {
+       g_mutex_free(obj->filter.lock);
        g_free(obj);
 }
--- linphone-1.3.4.3pcclevel/mediastreamer/msMUlawenc.c.fix     2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msMUlawenc.c 2007-01-03 
09:29:11.000000000 +0000
@@ -95,5 +95,6 @@
 
 void ms_MULAWencoder_destroy( MSMULAWEncoder *obj)
 {
+       g_mutex_free(obj->filter.lock);
        g_free(obj);
 }
--- linphone-1.3.4.3pcclevel/mediastreamer/msossread.c.fix      2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msossread.c  2007-01-03 
09:29:11.000000000 +0000
@@ -94,6 +94,7 @@
 
 void ms_oss_read_destroy( MSOssRead *obj)
 {
+       g_mutex_free(obj->filter.filter.lock);
        g_free(obj);
 }
 
--- linphone-1.3.4.3pcclevel/mediastreamer/msosswrite.c.fix     2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msosswrite.c 2007-01-03 
09:29:11.000000000 +0000
@@ -98,7 +98,7 @@
 
 void ms_oss_write_destroy( MSOssWrite *obj)
 {
-       
+       g_mutex_free(obj->filter.filter.lock);
        g_free(obj);
 }
 
--- linphone-1.3.4.3pcclevel/mediastreamer/msrtprecv.c.fix      2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msrtprecv.c  2007-01-03 
09:29:11.000000000 +0000
@@ -149,6 +149,7 @@
 
 void ms_rtp_recv_destroy( MSRtpRecv *obj)
 {
+       g_mutex_free(obj->filter.lock);
        g_free(obj);
 }
 
--- linphone-1.3.4.3pcclevel/mediastreamer/msrtpsend.c.fix      2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/mediastreamer/msrtpsend.c  2007-01-03 
09:29:11.000000000 +0000
@@ -152,6 +152,7 @@
 
 void ms_rtp_send_destroy( MSRtpSend *obj)
 {
+       g_mutex_free(obj->filter.lock);
        g_free(obj);
 }
 
--- linphone-1.3.4.3pcclevel/exosip/jrequest.c.fix      2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/exosip/jrequest.c  2007-01-03 09:29:11.000000000 
+0000
@@ -1043,11 +1043,17 @@
   osip_message_set_user_agent(request, eXosip.user_agent);
   /*  else if ... */
   *dest = request;
+  #ifdef SM
+  g_free(locip);
+  #endif
   return 0;
 
   /* grwd_error_2: */
   dialog->local_cseq--;
  grwd_error_1:
+  #ifdef SM
+  g_free(locip);
+  #endif
   osip_message_free(request);
   *dest = NULL;
   return -1;
--- linphone-1.3.4.3pcclevel/coreapi/linphonecore.c.fix 2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/coreapi/linphonecore.c     2007-01-03 
09:29:11.000000000 +0000
@@ -132,6 +132,7 @@
        call->did=did;
        call->core=lc;
        
call->sdpctx=sdp_handler_create_context(&linphone_sdphandler,linphone_core_get_nat_address_if_used(lc),me->url->username);
+       osip_from_free(me);
        linphone_call_init_common(call, osip_strdup(from), osip_strdup(to));
        return call;
 }
@@ -146,7 +147,8 @@
 
 LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, gchar *from, gchar 
*to){
        LinphoneCallLog *cl=g_new0(LinphoneCallLog,1);
-       cl->lc=call->core;
+       // Appears unused?
+       // cl->lc=call->core;
        cl->dir=call->dir;
        cl->start_date=g_strdup(ctime(&call->start_time));
        cl->from=from;
--- linphone-1.3.4.3pcclevel/coreapi/linphonecore.h.fix 2007-01-03 
09:27:13.000000000 +0000
+++ linphone-1.3.4.3pcclevel/coreapi/linphonecore.h     2007-01-03 
09:29:11.000000000 +0000
@@ -220,7 +220,8 @@
 } LinphoneCallStatus;
 
 typedef struct _LinphoneCallLog{
-       struct _LinphoneCore *lc;
+       // Appears unused?
+       // struct _LinphoneCore *lc;
        LinphoneCallDir dir;
        LinphoneCallStatus status;
        char *from;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]