You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -364,6 +365,20 @@ You can prime the stream's buffer before starting the stream by writing data or
364
365
365
366
The data in the buffer must match the data format returned by `mStream->getDataFormat()`.
366
367
368
+
### Handle routing changed event
369
+
370
+
A routing changed can happen when there is any peripheral connected/disconnected or any system-wide event, such as system Settings enable/disable a route, happens.
371
+
372
+
Before Android API level 37, when the routed device(s) is changed, Android AAudio framework will always disconnect the stream. See **Disconnected audio stream** section for more information about stream disconnection.
373
+
In Android API level 37, routing changed callback is introduced to notify apps when the routed devices are changed.
374
+
375
+
Instead of disconnecting stream at all cases, Android AAudio will now evaluate if the audio configuration stays similar when the routed device(s) is changed.
376
+
If the configuration stays the same but just the routed device(s) is changed, AAudio framework will fire a routing changed callback if it is register when opening.
377
+
This usually happens when the stream is offloaded or it is not on mmap path. If the audio configuration may be affected by routing changed, AAudio framework will
378
+
disconnect the stream. See **Disconnected audio stream** section for how to handle stream disconnection.
379
+
380
+
If your apps need to be notified when the routed device is changed, write a class which extends `AudioStreamRoutingCallback` and then register your class using `builder.setRoutingCallback(yourCallbackClass)`.
0 commit comments