OSDN Git Service
AVRCP: Fix changing track metadata too many times
Certain stacks may respond to GetPlayStatus before GetItemAttributes
(e.g iOS 6), which may cause Track to be changed due to duration being
different.
To fix this the code now only attempt to do GetPlayStatus once
GetItemAttributes completes, in addition to this do not require a exact
match of the duration because they can be different as can be observed
bellow:
> L2CAP(d): cid 0x0044 len 141 ctrl 0x0c16 fcs 0xa5ad [psm 27]
I-frame: Unsegmented TxSeq 11 ReqSeq 12
AVCTP Browsing: Response : pt 0x00 transaction 11 pid 0x110e
AVRCP: GetItemAttributes: len 0x0083
...
AttributeID: 0x00000007 (Track duration)
CharsetID: 0x006a (UTF-8)
AttributeLength: 0x0006 (6)
AttributeValue: 222641
...
> L2CAP(d): cid 0x0043 len 22 [psm 23]
AVCTP Control: Response : pt 0x00 transaction 2 pid 0x110e
AV/C: Stable: address 0x48 opcode 0x00
Subunit: Panel
Opcode: Vendor Dependent
Company ID: 0x001958
AVRCP: GetPlayStatus: pt Single len 0x0009
SongLength: 0x00036597 (222615 miliseconds)
SongPosition: 0x00000000 (0 miliconds)
PlayStatus: 0x02 (PAUSED)