From owner-freebsd-questions@FreeBSD.ORG Fri Dec 28 23:32:26 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D48C716A418 for ; Fri, 28 Dec 2007 23:32:26 +0000 (UTC) (envelope-from lenzi.sergio@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by mx1.freebsd.org (Postfix) with ESMTP id 901FB13C442 for ; Fri, 28 Dec 2007 23:32:26 +0000 (UTC) (envelope-from lenzi.sergio@gmail.com) Received: by an-out-0708.google.com with SMTP id c14so745214anc.13 for ; Fri, 28 Dec 2007 15:32:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; bh=9ujnxFE3X1xkVQds4UUeIdxgYwiG2yVD30sx8FoiqPc=; b=obQE8LpRbyZWR/FwYBfrhhHk9C4NWGB92Wr0VPOZ3+fdO0mnD+iYSiFI4fdOZpebF9bYf0EjATvXxxn98lmKEliEIlzXjtiyqCXRy02nQh3ODfdbniplgYFa7NX9X4NFIrXTgriX1VL5l2ggdSw+htBWBCOk1eXPTYwE90CO+o8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=WtLybMVCCihRlT0dDIN3xeODUGddCFkBaZ/5EaPHK5Vh/11Ou7gzjlwchwCcvPA6/pFTgIWxBtPHytyPTP0Z83MRJl7F17MDmzIg5zgjTR5bgunimia0UOD2cX1NaJ0migyp1WW7oCRZodinj6zqgob0lNiESDjP2EKGIBazbdk= Received: by 10.100.123.4 with SMTP id v4mr20163053anc.14.1198883246360; Fri, 28 Dec 2007 15:07:26 -0800 (PST) Received: from ?192.168.6.226? ( [189.30.138.217]) by mx.google.com with ESMTPS id 18sm13897473agb.10.2007.12.28.15.07.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 Dec 2007 15:07:25 -0800 (PST) From: Sergio Lenzi To: usleepless@gmail.com, questions@freebsd.org In-Reply-To: References: Date: Fri, 28 Dec 2007 21:06:23 +0000 Message-Id: <1198875983.1311.11.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.12.2 FreeBSD GNOME Team Port Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Ekiga runs but hangs X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Dec 2007 23:32:26 -0000 Em Sex, 2007-12-28 às 12:17 +0100, usleepless@gmail.com escreveu: > Hello All, > > is anyone using ekiga? ekiga runs and connects to 500@ekiga.net ( test number ). > > but when i hang up, or change volume using the ekiga-controls, the UI freezes. > > #FreeBSD host 7.0-BETA2 FreeBSD 7.0-BETA2 #4 > > i would love to hear succes or failures. > > regards, > > usleep it happens with me too. the problem is in the module sound-oss in the pwlib the module that deals with oss (the freebsd sound system...) tries to resample the stream and than loops... consuming all the cpu. the folowing patch solves the problem for me.... name this file to patch-oss and put it in /usr/ports/devel/pwlib/files and than... cd /usr/ports/devel/pwlib make clean deinstall package ========================================================= --- plugins/sound_oss/sound_oss.cxx.orig +++plugins/sound_oss/sound_oss.cxx @@ -565,7 +565,6 @@ entry->bitsPerSample = mBitsPerSample = _bitsPerSample; entry->isInitialised = FALSE; entry->fragmentValue = 0x7fff0008; - entry->resampleRate = 0; } // save the direction and device @@ -602,7 +601,6 @@ // do not re-initialise initialised devices if (entry.isInitialised) { PTRACE(6, "OSS\tSkipping setup for " << device << " as already initialised"); - resampleRate = entry.resampleRate; } else { PTRACE(6, "OSS\tInitialising " << device << "(" << (void *)(&entry) << ")"); @@ -646,17 +644,6 @@ arg = val = entry.sampleRate; if (ConvertOSError(::ioctl(os_handle, SNDCTL_DSP_SPEED, &arg))) { stat = TRUE; - - // detect cases where the hardware can't do the actual rate we need, but can do a simple multiple - if (arg != (int)entry.sampleRate) { - if (((arg / entry.sampleRate) * entry.sampleRate) == (unsigned)arg) { - PTRACE(3, "Resampling data at " << entry.sampleRate << " to match hardware rate of " << arg); - resampleRate = entry.resampleRate = arg / entry.sampleRate; - } else { - PTRACE_IF(4, actualSampleRate != (unsigned)val, "Actual sample rate selected is " << actualSampleRate << ", not " << entry.sampleRate); - actualSampleRate = arg; - } - } } } } @@ -724,42 +711,10 @@ if (!Setup() || os_handle < 0) return FALSE; - if (resampleRate == 0) { - while (!ConvertOSError(::write(os_handle, (void *)buf, len))) - if (GetErrorCode() != Interrupted) - return FALSE; - lastWriteCount += len; - } - - else { - // cut the data into 1K blocks and upsample it - lastWriteCount = 0; - BYTE resampleBuffer[1024]; - const BYTE * src = (const BYTE *)buf; - const BYTE * srcEnd = src + len; - while (src < srcEnd) { - - // expand the data by the appropriate sample ratio - BYTE * dst = resampleBuffer; - const BYTE * srcStart = src; - unsigned j; - - while ((src < srcEnd) && (dst < (resampleBuffer + sizeof(resampleBuffer) - resampleRate*2))) { - for (j = 0; j < resampleRate; ++j) { - memcpy(dst, src, 2); - dst += 2 ; - } - src += 2; - } - lastWriteCount += src - srcStart; - while (!ConvertOSError(::write(os_handle, resampleBuffer, dst - resampleBuffer))) { - if (GetErrorCode() != Interrupted) - return FALSE; - } - } - - } - + while (!ConvertOSError(::write(os_handle, (void *)buf, len))) + if (GetErrorCode() != Interrupted) + return FALSE; + lastWriteCount += len; return TRUE; } @@ -770,72 +725,26 @@ if (!Setup() || os_handle < 0) return FALSE; - if (resampleRate == 0) { - - PINDEX total = 0; - while (total < len) { - PINDEX bytes = 0; - while (!ConvertOSError(bytes = ::read(os_handle, (void *)(((unsigned char *)buf) + total), len-total))) { - if (GetErrorCode() != Interrupted) { - PTRACE(6, "OSS\tRead failed"); - return FALSE; - } - PTRACE(6, "OSS\tRead interrupted"); - } - total += bytes; - if (total != len) - PTRACE(6, "OSS\tRead completed short - " << total << " vs " << len << ". Reading more data"); - } - lastReadCount = total; - } - - else { - - // downsample the data - - BYTE * dst = (BYTE *)buf; - BYTE * dstEnd = dst + len; - lastReadCount = 0; - - PBYTEArray resampleBuffer((1024 / resampleRate) * resampleRate); - - // downsample the data into 1K blocks - while (dst < dstEnd) { - - - // calculate number of source bytes needed to fill the buffer - PINDEX srcBytes = resampleRate * (dstEnd - dst); - PINDEX bytes; - - { - PINDEX bufLen = PMIN(resampleBuffer.GetSize(), srcBytes); - while (!ConvertOSError(bytes = ::read(os_handle, resampleBuffer.GetPointer(), bufLen))) { - if (GetErrorCode() != Interrupted) - return FALSE; - } - } - - // use an average, not just a single sample - const BYTE * src = resampleBuffer; - while ( ((src - resampleBuffer) < bytes) && (dst < dstEnd)) { - int sample = 0; - unsigned j; - for (j = 0; j < resampleRate; ++j) { - sample += *(PUInt16l *)src; - src += 2; - } - *(PUInt16l *)dst = sample / resampleRate; - dst +=2 ; - lastReadCount += 2; + PINDEX total = 0; + while (total < len) { + PINDEX bytes = 0; + while (!ConvertOSError(bytes = ::read(os_handle, (void *)(((unsigned char *)buf) + total), len-total))) { + if (GetErrorCode() != Interrupted) { + PTRACE(6, "OSS\tRead failed"); + return FALSE; } + PTRACE(6, "OSS\tRead interrupted"); } + total += bytes; + if (total != len) + PTRACE(6, "OSS\tRead completed short - " << total << " vs " << len << ". Reading more data"); } + lastReadCount = total; if (lastReadCount != len) PTRACE(6, "OSS\tRead completed short - " << lastReadCount << " vs " << len); else PTRACE(6, "OSS\tRead completed"); - return TRUE; } --- plugins/sound_oss/sound_oss.h.orig 2007-12-03 03:31:15.000000000 +0000 +++ plugins/sound_oss/sound_oss.h 2007-12-03 03:31:29.000000000 +0000 @@ -42,7 +42,6 @@ unsigned bitsPerSample; unsigned fragmentValue; BOOL isInitialised; - unsigned resampleRate; }; class PSoundChannelOSS: public PSoundChannel @@ -99,5 +98,4 @@ Directions direction; PString device; BOOL isInitialised; - unsigned resampleRate; }; =============================================================