obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

Open the record and replay buffer at the same time, and pause the recording will cause failure to exit the OBS normally

Open TianQiBuTian opened this issue 3 years ago • 5 comments

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

Other

OBS Studio Version (Other)

27.2.4 & 28.0.0-4-g7396c211b

OBS Studio Log URL

https://obsproject.com/logs/KKfLofSh36TK2uFZ

OBS Studio Crash Log URL

No response

Expected Behavior

Exit the OBS normally and save the video file.

Current Behavior

After exit, the video is not saved successfully, and the icon in the lower right corner does not disappear and cannot be operated. Need to end the process in the task manager to exit and save the video successfully.

Steps to Reproduce

  1. Starting Record and Starting Replay Buffer.
  2. Pause Recording.
  3. Exit OBS.

Anything else we should know?

No response

TianQiBuTian avatar Sep 01 '22 14:09 TianQiBuTian

Reproduced on Windows 11, OBS seems stuck in destroying the replay buffer (which was paused when the recording was paused) - the tray icon remains as reported and upon killing the process via Task Manager the video file is actually written.

From what I could tell in the debugger, OBS is stuck at os_event_wait(output->stopping_event); in obs-output.c.

~~@notr1ch could it be that because the replay buffer was paused due to the recording having been paused, obs_output_actual_stop wasn't called and os_event_reset(output->stopping_event); or os_event_signal(output->stopping_event); never took place?~~

Scratch that, pausing the output doesn't deactivate it, will investigate further..

PatTheMav avatar Sep 14 '22 17:09 PatTheMav

My updated theory is that because the recording was paused, this check succeeds:

https://github.com/obsproject/obs-studio/blob/b1c65af2b1c2e7c3554efb0578ca92fd64c4519c/libobs/obs-encoder.c#L1295

The issue seems to be that the end_data_capture_thread (which signals the stopping_event) is only created if the send_audio_data is called below, which leads obs-ffmpeg-mux to check if the current timestamp has exceeded the stopping timestamp (which would call deactivate):

https://github.com/obsproject/obs-studio/blob/b1c65af2b1c2e7c3554efb0578ca92fd64c4519c/plugins/obs-ffmpeg/obs-ffmpeg-mux.c#L837

So: Because the recording is paused, the audio thread skips sending data to the encoder, but if no data is sent to the encoder and obs-ffmpeg-mux the stream is never stopped and the output waits forever for that to happen.

PatTheMav avatar Sep 14 '22 18:09 PatTheMav

Is this potentially related to #7144?

Fenrirthviti avatar Sep 14 '22 18:09 Fenrirthviti

Afaik that one was related to the seek position in the written file not being correctly adjusted and thus we were overwriting data at the same "old" seek position - R1ch might be in a better position to answer that.

PatTheMav avatar Sep 14 '22 18:09 PatTheMav

Possible duplicate of https://github.com/obsproject/obs-studio/issues/2162.

PatTheMav avatar Sep 15 '22 20:09 PatTheMav

@notr1ch FYI, maybe you can think of a fix for this?

PatTheMav avatar Sep 22 '22 12:09 PatTheMav

Same problem. When Replay Buffer is on, recording not working and stopping also not working anymore.

zandercodes avatar Apr 06 '23 21:04 zandercodes