Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed video/audio end services sometimes not being sent when secondary transport shuts down #1566

Conversation

NicoleYarroch
Copy link
Contributor

@NicoleYarroch NicoleYarroch commented Feb 21, 2020

Fixes #1551, #1561, #1471, #1479

This PR is ready for review.

Risk

This PR makes minor API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR (or explain why below)
  • I have run the unit tests with this PR
  • I have tested this PR against Core and verified behavior (if applicable, if not applicable, explain why below).

Unit Tests

Unit tests added/fixed for the streaming media manager classes.

Core Tests

Primary Transport Only Tests (Tested on SYNC 4.0 and SYNC 3.0)
  • Test putting app on device in background and then bringing it back to the foreground while video is streaming.
  • Test turning off ignition and restarting ignition while video is streaming.
  • Test turning off ignition and restarting ignition while device app is in background (i.e. app is open but not streaming video).
  • Test switching between two navigation apps (i.e. make sure video streaming resumes after the app's hmiLevel goes to BACKGROUND and back to FULL).
  • Test switching between the navigation and non-video streaming app ((i.e. make sure video streaming resumes after the app's hmiLevel goes to LIMITED and back to FULL).
  • Test disconnecting the transport while the device app is foregrounded and reconnecting transport when device app is foregrounded.
  • Test disconnecting the transport while the device app is foregrounded and reconnecting transport when device app is backgrounded.
  • Test disconnecting the transport while the device app is backgrounded and reconnecting transport when device app is foregrounded.
  • Test disconnecting the transport while the device app is backgrounded and reconnecting transport when device app is backgrounded.
Secondary Transport Tests (Tested on SYNC 4.0)
  • Test turning off Wifi on device and reconnecting to the system Wifi while video is streaming.
  • Test putting app on device in background and then bringing it back to the foreground while video is streaming.
  • Test turning off ignition and restarting ignition while video is streaming.
  • Test turning off ignition and restarting ignition while device app is in background (i.e. app is open but not streaming video).
  • Test switching between two navigation apps (i.e. make sure video streaming resumes after the app's hmiLevel goes to BACKGROUND and back to FULL).
  • Test switching between the navigation and non-video streaming app ((i.e. make sure video streaming resumes after the app's hmiLevel goes to LIMITED and back to FULL).
  • Test disconnecting the BT transport while the device app is foregrounded and reconnecting transport when device app is foregrounded.
  • Test disconnecting the BT transport while the device app is foregrounded and reconnecting transport when device app is backgrounded.
  • Test disconnecting the BT transport while the device app is backgrounded and reconnecting transport when device app is foregrounded.
  • Test disconnecting the BTtransport while the device app is backgrounded and reconnecting transport when device app is backgrounded.

Smoke tests performed with:
Core version / branch / commit hash / module tested against: SYNC 4 (20016_DEVTEST) and SYNC 3.0
HMI name / version / branch / commit hash / module tested against: SYNC 4 (20016_DEVTEST) and SYNC 3.0

Summary

  1. Fixed race condition with ending a video and/or audio service on the secondary transport where a video and/or audio end service control frame was not sent before the secondary transport was destroyed.
  2. Fixed the hmiLevel being reset when the secondary transport closed. This is not necessary as the primary transport is still open.
  3. The streaming video and audio lifecycle managers were not reset correctly when transport between device and module was destroyed, so sometimes an end video service request was sent incorrectly when a new session opened.

Changelog

Bug Fixes
  • The pixel buffer pool in the SDLH264VideoEncoder class sometimes randomly invalidates itself when the device app is backgrounded. Handling was added to reset the pixel buffer pool when it becomes nil.
  • If the response to the video start service comes after the app has been put in the background, the app now transitions to the suspended state instead of attempting to send video frames.
  • Fixed a race condition causing the secondary transport to not always properly end the video / audio services.
  • The streaming video and audio lifecycle managers were not reset correctly when transport between device and module was destroyed, so sometimes an end video service request was sent incorrectly when a new session opened.

CLA

NicoleYarroch and others added 10 commits March 20, 2020 08:51
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
…transport' of https://github.com/smartdevicelink/sdl_ios into bugfix/issue_1551_video_end_service_not_sent_secondary_transport

# Conflicts:
#	SmartDeviceLink/SDLSecondaryTransportManager.m
…ent_secondary_transport

# Conflicts:
#	SmartDeviceLink/SDLLifecycleManager.m
#	SmartDeviceLink/SDLStreamingAudioLifecycleManager.m
#	SmartDeviceLink/SDLStreamingMediaManager.h
#	SmartDeviceLink/SDLStreamingMediaManager.m
#	SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m
#	SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
[self sdl_cancelIOThread];

if (self.ioThread == nil) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it ever be nil here? I don't think that it can be since the only place it's set to nil is below in the performSelector for sdl_disconnect, and we already checked for nil above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this code after testing. It does not appear to be necessary anymore.

Comment on lines 110 to 111
// The `ioThread` could not be woken up to be cancelled. Switch to the `ioThread` and perform the cleanup of the input/output streams
[self performSelector:@selector(sdl_disconnect) onThread:self.ioThread withObject:nil waitUntilDone:NO];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem correct. If the ioThread is cancelled, it's not automatically nil right? So this will always run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this code after testing. It does not appear to be necessary anymore.

@joeljfischer
Copy link
Contributor

I did as much other testing as was possible. I had some issues with a Sync 3.4 Bluetooth setup where I was getting SetAppIcon rejected and ListFiles disallowed, so I was unable to do extensive testing of this particular case. All other cases seem to be working very well.

SmartDeviceLink/SDLTCPTransport.m Show resolved Hide resolved
SmartDeviceLink/SDLTCPTransport.m Show resolved Hide resolved
v6.6.0 automation moved this from Waiting for Review to Reviewer approved Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect in the library transport-secondary Relating to the secondary transport
Projects
No open projects
v6.6.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants