Skip to content

libobs: Last audio appears when restart audio playback #7063

Open

Description

@norihiro

Operating System Info

Other

Other OS

Fedora 35

OBS Studio Version

Git

OBS Studio Version (Other)

28.0.0-beta2-19-g7eb46d50b

OBS Studio Log URL

https://obsproject.com/logs/yOia20gn6s7Oyz57

OBS Studio Crash Log URL

No response

Expected Behavior

When starting to play an audio file, the audio from the beginning of the audio file appears.

Current Behavior

When starting to play an audio file, the last several frames of the audio file is first played back, then the desired audio is played back.

Steps to Reproduce

  1. Setup OBS profile and ensure audio sampling frequency is 48 kHz. Also set transition to Cut.
  2. Create three scenes named Scene, Chirp 44k1, Chirp 48k.
  3. In the scene Chirp 44k1, add a media source and set a audio file whose sampling frequency is 44.1 kHz and which has a chirp starting from low frequency to high frequency.
  4. In the scene Chirp 48k, add a media source and set a audio file whose sampling frequency is 48 kHz and which has a chirp starting from low frequency to high frequency.
  5. Switch to the scene Scene.
  6. Restart OBS
  7. Start recording
  8. Switch scene to Chirp 48k and wait until playback ended.
  9. Switch scene to Chirp 44k1 and wait until playback ended.
  10. Switch scene to Chirp 48k and wait until playback ended.
  11. Switch scene to Chirp 44k1 and wait until playback ended.
  12. Stop recording.
  13. Check recording

A waveform below is the beginning of the step 11. The very high frequency wave comes from the end of the audio file. The very low frequency wave comes from the beginning of the audio file.
Screenshot_2022-08-14_19-46-13

Anything else we should know?

Suspecting last samples are remaining in libswscale (the sample rate converter).

I believe this bug has existed for many versions. I found this bug while editing libobs/media-io/audio-resampler-ffmpeg.c for another purpose.

Maybe we need to add an API on libobs for a source to notify there is no more audio and libobs has to flush remaining audio in the resampler.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions