Skip to content
Snippets Groups Projects
Commit 750124f1 authored by Ajay Panicker's avatar Ajay Panicker
Browse files

Set the AVRCP Browsing MTU for a device after browse open

Trying to get the Browsing MTU before the Browsing channel is opened
returns the minimum MTU. This leads to smaller browsing messages than
expected.

Bug: 113160447
Test: Connect to device and see that Avrcp Browse packets are the
correct size

Change-Id: Iefda855d0a777439a8a6829619bc4c5543b62eaf
parent 7fc931a4
No related branches found
No related tags found
No related merge requests found
......@@ -273,13 +273,20 @@ void ConnectionHandler::InitiatorControlCb(uint8_t handle, uint8_t event,
device_map_.erase(handle);
} break;
case AVRC_BROWSE_OPEN_IND_EVT:
case AVRC_BROWSE_OPEN_IND_EVT: {
LOG(INFO) << __PRETTY_FUNCTION__ << ": Browse Open Event";
// NOTE (apanicke): We don't need to explicitly handle this message
// since the AVCTP Layer will still send us browsing messages
// regardless. It would be useful to note this though for future
// compatibility issues.
break;
if (device_map_.find(handle) == device_map_.end()) {
LOG(WARNING) << "Browse Opened received from device that doesn't exist";
return;
}
auto browse_mtu = avrc_->GetBrowseMtu(handle) - AVCT_HDR_LEN;
device_map_[handle]->SetBrowseMtu(browse_mtu);
} break;
case AVRC_BROWSE_CLOSE_IND_EVT:
LOG(INFO) << __PRETTY_FUNCTION__ << ": Browse Close Event";
break;
......@@ -357,13 +364,20 @@ void ConnectionHandler::AcceptorControlCb(uint8_t handle, uint8_t event,
device_map_.erase(handle);
} break;
case AVRC_BROWSE_OPEN_IND_EVT:
case AVRC_BROWSE_OPEN_IND_EVT: {
LOG(INFO) << __PRETTY_FUNCTION__ << ": Browse Open Event";
// NOTE (apanicke): We don't need to explicitly handle this message
// since the AVCTP Layer will still send us browsing messages
// regardless. It would be useful to note this though for future
// compatibility issues.
break;
if (device_map_.find(handle) == device_map_.end()) {
LOG(WARNING) << "Browse Opened received from device that doesn't exist";
return;
}
auto browse_mtu = avrc_->GetBrowseMtu(handle) - AVCT_HDR_LEN;
device_map_[handle]->SetBrowseMtu(browse_mtu);
} break;
case AVRC_BROWSE_CLOSE_IND_EVT:
LOG(INFO) << __PRETTY_FUNCTION__ << ": Browse Close Event";
break;
......
......@@ -59,6 +59,11 @@ void Device::RegisterInterfaces(MediaInterface* media_interface,
volume_interface_ = volume_interface;
}
void Device::SetBrowseMtu(uint16_t browse_mtu) {
DEVICE_LOG(INFO) << __PRETTY_FUNCTION__ << ": browse_mtu = " << browse_mtu;
browse_mtu_ = browse_mtu;
}
bool Device::IsActive() const {
return address_ == a2dp_interface_->active_peer();
}
......
......@@ -90,6 +90,12 @@ class Device {
A2dpInterface* a2dp_interface,
VolumeInterface* volume_interface);
/**
* Set the maximum size of a AVRCP Browsing Packet. This is done after the
* connection of the Browsing channel.
*/
void SetBrowseMtu(uint16_t browse_mtu);
/**
* Notify the device that metadata, play_status, and/or queue have updated
* via a boolean. Each boolean represents whether its respective content has
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment