diff options
author | Justin Beharry <justin.beharry@livio.io> | 2022-08-12 14:00:47 -0400 |
---|---|---|
committer | Justin Beharry <justin.beharry@livio.io> | 2022-08-12 14:00:47 -0400 |
commit | 520b0d1be9e4a9341487eaadc35bcf8edba7c109 (patch) | |
tree | f7ea0165df03e68d8867ba8823f863f94e0d962a | |
parent | aba5ba83d902a1c5e7e68915180eaae319855430 (diff) | |
download | sdl_ios-bugfix/issue-1598-audio-manager-suspend.tar.gz |
stop transcoding audio on secondary disconnectbugfix/issue-1598-audio-manager-suspend
-secondaryTransportDidDisconnect should stop transcoding audio
-Add unit test to make sure the stop transcoding method is called
-rw-r--r-- | SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m | 1 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m index 4a3195613..ceebe7bd6 100644 --- a/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m +++ b/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m @@ -101,6 +101,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)secondaryTransportDidDisconnect { + [self.audioTranscodingManager stop]; [self.audioStreamStateMachine transitionToState:SDLAudioStreamManagerStateStopped]; } diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m index cca65997b..5a6c58e4f 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m @@ -408,6 +408,20 @@ describe(@"the streaming audio manager", ^{ }); }); + describe(@"when secondary transport disconnects", ^{ + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateReady fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager secondaryTransportDidDisconnect]; + }); + + it(@"should transition to the stopped state and stop transcoding", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + + expect(streamingLifecycleManager.protocol).to(beNil()); + OCMVerify([mockAudioStreamManager stop]); + }); + }); + describe(@"starting the manager when it's STOPPED", ^{ __block SDLProtocol *protocolMock = OCMClassMock([SDLProtocol class]); |