obs-studio
obs-studio copied to clipboard
libobs: Fix audio-only output did not receive raw_audio
Description
Fix audio-only output did not receive raw_audio
callback at all.
Motivation and Context
I want to make a plugin that outputs mixed audio track(s).
When defining obs_output_info
as below, the callback raw_audio
was never called.
struct obs_output_info vban_output_info = {
.id = ID_PREFIX "output",
.flags = OBS_OUTPUT_AUDIO,
.get_name = vban_out_get_name,
.create = vban_out_create,
.destroy = vban_out_destroy,
.start = vban_out_start,
.stop = vban_out_stop,
.raw_audio = vban_out_raw_audio,
.update = vban_out_update,
.get_defaults = vban_out_get_defaults,
.get_properties = vban_out_get_properties,
};
As a workaround, audio arrives if adding OBS_OUTPUT_VIDEO
to flags
and defining raw_video
. However, I don't think this workaround is not ideal as it causes raw-video to be sent from the GPU.
How Has This Been Tested?
- Build norihiro/obs-vban/pull/1 with modification of
vban_output_info
as above code. - Start the output.
- Check
raw_audio
is called.
OS: Fedora 35.
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
Previously I fixed audio-only output using ffmpeg-output
.
- https://github.com/obsproject/obs-studio/pull/5418
The output ffmpeg-output
receives video frames because a flag OBS_OUTPUT_VIDEO
is set and a callback raw_video
is defined. The video frames are discarded inside ffmpeg-output
.
This PR addresses a fix for output whose flag has only OBS_OUTPUT_AUDIO
so that this is a different issue.
Just rebased to the latest master branch.
@Lain-B Any objections to this? Seems to only return only from the prepare_audio
function if the source is audio-only, as no alignment with video timestamps is necessary.