module-rtp: fix compilation without opus

This commit is contained in:
Wim Taymans 2023-03-12 19:04:14 +01:00
parent 345582dd15
commit 59d5d93878
3 changed files with 11 additions and 6 deletions

View file

@ -284,6 +284,7 @@ cdata.set('HAVE_PW_CAT_FFMPEG_INTEGRATION', pw_cat_ffmpeg.allowed())
opus_dep = dependency('opus', required : get_option('opus'))
summary({'opus (Bluetooth, RTP)': opus_dep.found()}, bool_yn: true, section: 'Misc dependencies')
cdata.set('HAVE_OPUS', opus_dep.found())
summary({'readline (for pw-cli)': readline_dep.found()}, bool_yn: true, section: 'Misc dependencies')
cdata.set('HAVE_READLINE', readline_dep.found())

View file

@ -2,12 +2,11 @@
/* SPDX-FileCopyrightText: Copyright © 2023 Wim Taymans <wim.taymans@gmail.com> */
/* SPDX-License-Identifier: MIT */
#ifdef HAVE_OPUS
#include <opus/opus.h>
#include <opus/opus_multistream.h>
struct rtp_opus_data {
};
static void rtp_opus_process_playback(void *data)
{
struct impl *impl = data;
@ -367,3 +366,9 @@ static int rtp_opus_init(struct impl *impl, enum spa_direction direction)
pw_log_error("opus error: %d", err);
return impl->stream_data ? 0 : err;
}
#else
static int rtp_opus_init(struct impl *impl, enum spa_direction direction)
{
return -ENOTSUP;
}
#endif

View file

@ -5,9 +5,6 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <opus/opus.h>
#include <opus/opus_multistream.h>
#include <spa/utils/result.h>
#include <spa/utils/json.h>
#include <spa/utils/ringbuffer.h>
@ -292,11 +289,13 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_control;
impl->payload = 0x61;
}
#ifdef HAVE_OPUS
else if (spa_streq(str, "opus")) {
impl->info.media_type = SPA_MEDIA_TYPE_audio;
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_opus;
impl->payload = 127;
}
#endif
else {
pw_log_error("unsupported media type:%s", str);
res = -EINVAL;