2008-03-17 15:51:45     mediastream, alsa, ad1981 and mmap

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-03-17 15:51:45     mediastream, alsa, ad1981 and mmap

Cameron Barfield (UNITED STATES)

Message: 52600   

I've got mmap/dmix working now (off of the 2008 branch).

 

When running mediastream (from linphone 2.0.1) with mmap enabled for the ad1981, I get the following:

 

ortp-warning-alsa_set_params: The period size 256 is not supported by your hardware.

==> Using 85 instead.                                                                                                                                       

 

ortp-warning-Only 85 samples written instead of 160

ortp-warning-We are late of 143 miliseconds.

ortp-warning-Only 85 samples written instead of 160

ortp-warning-Only 85 samples written instead of 160

ortp-warning-Only 85 samples written instead of 160

ortp-warning-Only 85 samples written instead of 160

 

Sometimes, I'll also get a kernel panic:

 

Data access CPLB miss

- Used by the MMU to signal a CPLB miss on a data access.

Kernel OOPS in progress                                                                                                                            

 

mediastream used to work with a period size of 256, and it probably still does if mmap is disabled (I haven't checked yet). I've tried a handful of other values for the period size, but I always end up getting pushed down to 85.

 

How does changing to mmap affect the way alsa decides what period size the hardware supports? Also, how does one go about choosing the correct period size (I know that last question is for the linphone group, but they're really hit-and-miss about whether or not they answer).

QuoteReplyEditDelete

 

 

2008-03-17 16:06:08     Re: mediastream, alsa, ad1981 and mmap

Cameron Barfield (UNITED STATES)

Message: 52603    Maybe I answered my own question:

 

root:/> cat proc/asound/bf5xxboard/pcm0p/sub0/hw_params

access: MMAP_INTERLEAVED

format: S16_LE

subformat: STD

channels: 2

rate: 48000 (48000/1)

period_size: 512

buffer_size: 8192

tick_time: 4000

 

But even if I set period size to 512 in mediastreamer2/src/alsa.c, I get the same errors/warnings.

QuoteReplyEditDelete

 

 

2008-03-17 22:02:01     回复: mediastream, alsa, ad1981 and mmap

Cliff Cai (CHINA)

Message: 52623   

 

Currently,when enable mmap,the dmix plugin is also enabled.Because dmix never check underrun(never stop/restart during playing),so it will cause a period time of noise at the time when underrun should happens(especially in linphone case),alsa developer suggests that increasing the period_size and buffer_size is good to alleviate this situation,for stabilization consideration ,currently  I set a fixed period_size (1536) when enable mmap.

QuoteReplyEditDelete

 

 

2008-03-17 22:07:14     回复: mediastream, alsa, ad1981 and mmap

Cliff Cai (CHINA)

Message: 52624   

 

BTW,please update the code to the latest revision.

 

Cliff

QuoteReplyEditDelete

 

 

2008-03-18 14:00:43     Re: 回复: mediastream, alsa, ad1981 and mmap

Cameron Barfield (UNITED STATES)

Message: 52714    I updated my sources.

 

The warnings about period size and samples written are gone, but I'm hearing audible pops and scratches in the audio stream when under runs occur now.

QuoteReplyEditDelete

 

 

2008-03-18 18:34:02     Re: 回复: mediastream, alsa, ad1981 and mmap

Cameron Barfield (UNITED STATES)

Message: 52722    The pops happen anywhere from every 30 seconds to every 4 minutes.

 

Basically, it's come back around to where we were on 2007-10-29:

http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3597

 

I'll let the latest branch build run overnight to test for longevity anyway.

QuoteReplyEditDelete

 

 

2008-03-18 19:32:56     Re: 回复: mediastream, alsa, ad1981 and mmap

Cameron Barfield (UNITED STATES)

Message: 52723    Maybe not...

 

The pops may have been hardware related. The two boards we were testing on had poor quality crystals installed on the 1980. I'll run over night on good hardware and let you know what happens.

QuoteReplyEditDelete

 

 

2008-03-19 11:26:27     Re: 回复: mediastream, alsa, ad1981 and mmap

Cameron Barfield (UNITED STATES)

Message: 52760    The changes you made Monday night appear to be working quite well. With the new period size, I no longer get any warnings about sample rates being incorrect or that too few samples are being written.

 

The pops and under runs were being caused by fault hardware. When I re-tested using a good crystal, I only see one under run every 3-5 minutes and there is no corresponding pop.

 

Thank you very much 

QuoteReplyEditDelete

 

 

2008-03-19 22:39:41     回复: Re: 回复: mediastream, alsa, ad1981 and mmap

Cliff Cai (CHINA)

Message: 52793    You are welcome!

 

Cliff

Attachments

    Outcomes