smartdevicelink / sdl_ios

Get your app connected to the 🚙, make your users feel like a 🌟
www.smartdevicelink.com
BSD 3-Clause "New" or "Revised" License
169 stars 105 forks source link

SSRC in RTP header changes after video suspend #1132

Closed t-yoshii closed 5 years ago

t-yoshii commented 5 years ago

Bug Report

SSRC in RTP header is generated in SDLRTPH264Packetizer constructor. When VideoStreaming state changed to ready => suspended => ready, SDLRTPH264Packetizer instance is re-initialized and SSRC is also regenerated.

SSRC should not change during RTP session.(RFC 3550) HU expects same SSRC is used even after suspend. (HU cannot even know HS entered suspended state because it does not stop video service)

Some HU video decoder will have trouble with this behavior.

Reproduction Steps
  1. Connect SDL app to SDL Core with RTP video supported HMI
  2. Start video streaming
  3. Suspend video streaming (SDL app resigns active)
  4. Make SDL app foreground
Expected Behavior
  1. SSRC does not change from 2.
Observed Behavior
  1. SSRC change from 2.
OS & Version Information
Test Case, Sample Code, and / or Example App

None

t-yoshii commented 5 years ago

SSRC is generated here. https://github.com/smartdevicelink/sdl_ios/blob/3bb5e39e98ea18a176f1c60cfdd8284902f2c262/SmartDeviceLink/SDLRTPH264Packetizer.m#L74

I think there are 2 way to fix this.

  1. Store SSRC at higher component. If we store SSRC in SDLStreamingMediaLifecycleManager (or other higher component), it does not change even after suspend.

  2. Do not re-initialize video encoder and packetizer after suspend. Video encoder (and packetizer) is always initialized when video state becomes ready. https://github.com/smartdevicelink/sdl_ios/blob/3bb5e39e98ea18a176f1c60cfdd8284902f2c262/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m#L394 Is it possible to skip this initialization after suspend?

NicoleYarroch commented 5 years ago

Fixed in PR #1137