예제 #1
0
/* resamples/remixes new audio to the designated main audio output format */
static void process_audio(obs_source_t source, const struct source_audio *audio)
{
    if (source->sample_info.samples_per_sec != audio->samples_per_sec ||
            source->sample_info.format          != audio->format          ||
            source->sample_info.speakers        != audio->speakers)
        reset_resampler(source, audio);

    if (source->audio_failed)
        return;

    if (source->resampler) {
        void *output;
        uint32_t frames;
        uint64_t offset;

        audio_resampler_resample(source->resampler, &output, &frames,
                                 audio->data, audio->frames, &offset);

        copy_audio_data(source, output, frames,
                        audio->timestamp - offset);
    } else {
        copy_audio_data(source, audio->data, audio->frames,
                        audio->timestamp);
    }
}
예제 #2
0
/* resamples/remixes new audio to the designated main audio output format */
static void process_audio(obs_source_t source, const struct source_audio *audio)
{
	if (source->sample_info.samples_per_sec != audio->samples_per_sec ||
	    source->sample_info.format          != audio->format          ||
	    source->sample_info.speakers        != audio->speakers)
		reset_resampler(source, audio);

	if (source->audio_failed)
		return;

	if (source->resampler) {
		uint8_t  *output[MAX_AV_PLANES];
		uint32_t frames;
		uint64_t offset;

		memset(output, 0, sizeof(output));

		audio_resampler_resample(source->resampler,
				output, &frames, &offset,
				audio->data, audio->frames);

		copy_audio_data(source, (const uint8_t *const *)output, frames,
				audio->timestamp - offset);
	} else {
		copy_audio_data(source, audio->data, audio->frames,
				audio->timestamp);
	}
}