twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
457 stars 177 forks source link

ISDK-3191 - Play continuous music before-during-and-after the call #589

Closed piyushtank closed 3 years ago

piyushtank commented 3 years ago

This Pull Request adds functionality in ExampleAVAudioEngineAudioDevice to play continuous music before connecting to a Room, while in a Room, or after disconnect. The PR adds two APIs in ExampleAVAudioEngineAudioDevice which can be used to start and stop the continuous music using the core audio. The ExampleAVAudioEngineAudioDevice uses continuousMusic flag to determine if it should continue playing music or not.

To play continuous music, the PR establishes the core audio upon continuousMusic request is received by ExampleAVAudioEngineAudioDevice.

While validating the audio route change, I ran into the following 100% reproducible error when call is not connected to the Room and music is being played by the same core audio -

02-02 22:47:43.653057-0800 AudioDeviceExample[37879:6664359] Expected 1156 frames but got 1536.
2021-02-02 22:47:43.653469-0800 AudioDeviceExample[37879:6664359] kAudioUnitErr_TooManyFramesToProcess : inFramesToProcess=1536, mMaxFramesPerSlice=1156
2021-02-02 22:47:43.653663-0800 AudioDeviceExample[37879:6664359] Can handle a max of 1156 frames but got 1536.
2021-02-02 22:47:43.685026-0800 AudioDeviceExample[37879:6664359] Expected 1156 frames but got 1536.
2021-02-02 22:47:43.685248-0800 AudioDeviceExample[37879:6664359] Can handle a max of 1156 frames but got 1536.
2021-02-02 22:47:43.717022-0800 AudioDeviceExample[37879:6664359] Expected 1156 frames but got 1536.

I have fixed this error by setting the kAudioUnitProperty_MaximumFramesPerSlice but we can discuss the fix during code review.

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

piyushtank commented 3 years ago

Live review with @ceaglest

  1. Let's not do looping
  2. Hookup the capturer pipeline as well