linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question about 'read' system call of sco socket
@ 2010-03-02 14:28 liu yang
  2010-03-03  2:42 ` Zhu Yanhai
  0 siblings, 1 reply; 2+ messages in thread
From: liu yang @ 2010-03-02 14:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Tan Miaoqing, Valerio Valerio

Hi experts,
I have one question about 'read' system call of sco socket. I'm using
an open source  library which implements bluetooth handfree profile on
linux platform. About our use case, cell phone works as audio gateway
that all audio received on cell phone will be streamed to linux PC,
and vice versa. Everything works just fine of audio streaming above
bluetooth channel. But our special application is very sensitive on
timing that we need send/receive bluetooth audio frame every 20ms.
Regarding sending direction, I can tweak MTU of bluetooth donglel
installed on my linux PC. Let's say, MTU is set to 320 bytes, so every
20ms 'send' system call only needs be called one time. ( the audio
frame conveyed aboved bluetooth is of signed linear 16bit per sample,
8K sampling-rate )  But this does not affect receiving direction that
every 'read' system call on sco socket returns exact 48 bytes. Also I
find such 'read' event on linux 'poll' is triggered every 10ms. Every
10ms, such 'read' action is invoked, but it takes 3 or 4 times
invokation ( sometimes 3 , sometimes 4) of  'read' to consume this
'read' event, which results in 'EAGAIN'. So every 20ms, I get 288
(48*6) or 336 (48*7)  bytes, not exact 320 I expect.

Shortly, my question is how to receive ( 'read' system call ) exact
320 bytes every 20ms.

Thanks

Kandy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-03  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-02 14:28 question about 'read' system call of sco socket liu yang
2010-03-03  2:42 ` Zhu Yanhai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).