OSDN Git Service

bluez a2dp - fix state machine synchronization
authorIan Kent <raven@themaw.net>
Mon, 28 Sep 2009 15:47:44 +0000 (23:47 +0800)
committerIan Kent <raven@themaw.net>
Tue, 29 Sep 2009 05:14:10 +0000 (13:14 +0800)
commit4cd45565a91a1418666927393ea7bd3f6cd4c6f7
treee6b129919e23dda415c5afcb1ed21782031b7d98
parentce4f50efcce160b3b00cca4c793066eeeb9ed03c
bluez a2dp - fix state machine synchronization

Using a worker thread implementation for A2DP means that if we don't
have some way to syncroniize state transitions we can get overlap of
requested command functions or lost signals. In order for the A2DP
state machine to function each command operation must complete before
the next is initiated or we will get errors caused by these out of
sequence commands. And if we signal the thread when it is not waiting
on the condition the signal will be missed.

This could be partly resolved by implementing a queue but then there
is an overhead with also implementing a wait mechamism for state
transitions. It's much easier and simpler to just hold the mutex
during command processing which also deals with the lost signals issue.
This may well not achieve the original goal of the worker thread
implementation but neither would a queue implementation. It looks
like this is just the way things are!
utils/audio/liba2dp.c