OSDN Git Service

Revert "Always restrict the AVDTP MTU for SBC codec to MAX_2MBPS_AVDTP_MTU(663)"
authorPavlin Radoslavov <pavlin@google.com>
Fri, 21 Jul 2017 00:51:07 +0000 (00:51 +0000)
committerPavlin Radoslavov <pavlin@google.com>
Fri, 21 Jul 2017 01:00:13 +0000 (18:00 -0700)
This reverts commit 9eee3a772b3f23e5c33845422203f0dec07be234.

Not needed anymore - handled by the interoperability database.

Bug: 62394764
Bug: 34127145
Test: Audio streaming to headset that supports 3Mbps
Change-Id: I143c07c171e0fe9ef882c5e506545187f9e41498
(cherry picked from commit a97b0381c8626320151c246cfd9a71dedcf635ff)

stack/a2dp/a2dp_sbc_encoder.cc

index 5d48c79..e4c2049 100644 (file)
@@ -753,14 +753,21 @@ static uint8_t calculate_max_frames_per_packet(void) {
 
   LOG_VERBOSE(LOG_TAG, "%s: original AVDTP MTU size: %d", __func__,
               a2dp_sbc_encoder_cb.TxAaMtuSize);
+  if (a2dp_sbc_encoder_cb.is_peer_edr &&
+      !a2dp_sbc_encoder_cb.peer_supports_3mbps) {
+    // This condition would be satisfied only if the remote device is
+    // EDR and supports only 2 Mbps, but the effective AVDTP MTU size
+    // exceeds the 2DH5 packet size.
+    LOG_VERBOSE(LOG_TAG,
+                "%s: The remote device is EDR but does not support 3 Mbps",
+                __func__);
 
-  // Restrict the MTU - even though some Sink devices are advertising large
-  // MTU, they are not able to handle the packets and are stuttering.
-  if (effective_mtu_size > MAX_2MBPS_AVDTP_MTU) {
-    LOG_WARN(LOG_TAG, "%s: Restricting AVDTP MTU size to %d", __func__,
-             MAX_2MBPS_AVDTP_MTU);
-    effective_mtu_size = MAX_2MBPS_AVDTP_MTU;
-    a2dp_sbc_encoder_cb.TxAaMtuSize = effective_mtu_size;
+    if (effective_mtu_size > MAX_2MBPS_AVDTP_MTU) {
+      LOG_WARN(LOG_TAG, "%s: Restricting AVDTP MTU size to %d", __func__,
+               MAX_2MBPS_AVDTP_MTU);
+      effective_mtu_size = MAX_2MBPS_AVDTP_MTU;
+      a2dp_sbc_encoder_cb.TxAaMtuSize = effective_mtu_size;
+    }
   }
 
   if (!p_encoder_params->s16NumOfSubBands) {