linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] OSS plug-in don't flush buffers when starts.


From: damico
Subject: [Linphone-developers] OSS plug-in don't flush buffers when starts.
Date: Mon, 01 Sep 2008 16:11:31 +0200
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

Hi Simon,

I'm using linphone with OSS output (embedded board) and I found an issue on that plug-in: I start a call, while I'm speaking stop a call: the next time that I start OSS player of mediastreamer2 I could hear the end of that I have spoken in the previous call. That "buffer" could increase at every call.

The root cause of that behaviour is that MSBufferizer object used for buffering the write data is never flushed (just when OSS pluging is destroyed).

The input queue should have the same problem but less evident because the read queue should contains 0/1 packet almost every time.

I attach a patch that solve that issue.

Regards

--Michele
### Eclipse Workspace Patch 1.0
#P linphone_upstream
Index: mediastreamer2/src/oss.c
===================================================================
RCS file: /sources/linphone/linphone/mediastreamer2/src/oss.c,v
retrieving revision 1.9
diff -u -r1.9 oss.c
--- mediastreamer2/src/oss.c    22 Apr 2008 15:06:14 -0000      1.9
+++ mediastreamer2/src/oss.c    1 Sep 2008 14:03:09 -0000
@@ -437,10 +437,13 @@
 
 static void oss_start_r(MSSndCard *card){
        OssData *d=(OssData*)card->data;
+       ms_mutex_lock(&d->mutex);
        if (d->read_started==FALSE && d->write_started==FALSE){
                d->read_started=TRUE;
                ms_thread_create(&d->thread,NULL,oss_thread,card);
        }else d->read_started=TRUE;
+       flushq(&d->rq,0);
+       ms_mutex_unlock(&d->mutex);
 }
 
 static void oss_stop_r(MSSndCard *card){
@@ -451,14 +454,22 @@
        }
 }
 
+static void _flush_buffer(MSBufferizer *obj){
+       flushq(&obj->q,0);
+       obj->size=0;
+}
+
 static void oss_start_w(MSSndCard *card){
        OssData *d=(OssData*)card->data;
+       ms_mutex_lock(&d->mutex);
        if (d->read_started==FALSE && d->write_started==FALSE){
                d->write_started=TRUE;
                ms_thread_create(&d->thread,NULL,oss_thread,card);
        }else{
                d->write_started=TRUE;
        }
+       _flush_buffer(d->bufferizer);
+       ms_mutex_unlock(&d->mutex);
 }
 
 static void oss_stop_w(MSSndCard *card){

reply via email to

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