smartdevicelink / sdl_core

SmartDeviceLink In-Vehicle Software and Sample HMI
BSD 3-Clause "New" or "Revised" License
241 stars 245 forks source link

Core doesn't utilize samplingRate and bitsPerSample parameters provided by HMI when guessing playback time #3831

Closed dboltovskyi closed 2 years ago

dboltovskyi commented 2 years ago

Bug Report

Within fix pull/3057 Core tries to guess playback time using formula:

latency_compensation = 500;
timeout = 1000 * data_size / (sampling_rate_ * bits_per_sample_ / 8) + latency_compensation;

where sampling_rate_ and bits_per_sample_ are the values provided by HMI within pcmStreamCapabilities

However Core always use hardcoded values for bitsPerSample=16 and samplingRate=16000 and doesn't take into account the ones provided by HMI.

Reproduction Steps
  1. Make sure HMI provides non-default bitsPerSample and samplingRate values (e.g. samplingRate=32000)
  2. Set AudioStreamConsumer to socket and AudioStreamingPort to 5080 in smartDeviceLink.ini.
  3. Start audio stream from app (accept prompt from HMI to start audio stream)
  4. Start reading audio stream using the following gstreamer command:
    time gst-launch-1.0 souphttpsrc location=http://127.0.0.1:5080 ! audio/x-raw,format=S16LE,rate=32000,channels=1 ! pulsesink
  5. Notice duration when gstreamer exits (socket is closed)
Expected Behavior

Socket is closed once audio stopped playing

Observed Behavior

Socket remains open some time after audio stopped playing. Looks like the values from pcmStreamCapabilities provided by HMI wasn't taken into account.

OS & Version Information
dboltovskyi commented 2 years ago

@theresalech Please notice Luxoft team is going to provide a fix for this issue

jacobkeeler commented 2 years ago

Closed via #3837