Skip to content

Commit b3cca50

Browse files
committed
avformat/librist: bump required version to 0.2.7
This is the first version for which fifo size setting actually works. Signed-off-by: Marton Balint <[email protected]>
1 parent 2d76406 commit b3cca50

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6604,7 +6604,7 @@ enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.
66046604
enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
66056605
enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
66066606
enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new
6607-
enabled librist && require_pkg_config librist "librist >= 0.2" librist/librist.h rist_receiver_create
6607+
enabled librist && require_pkg_config librist "librist >= 0.2.7" librist/librist.h rist_receiver_create
66086608
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
66096609
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
66106610
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"

libavformat/librist.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@
3838

3939
// RIST_MAX_PACKET_SIZE - 28 minimum protocol overhead
4040
#define MAX_PAYLOAD_SIZE (10000-28)
41-
42-
#define FF_LIBRIST_MAKE_VERSION(major, minor, patch) \
43-
((patch) + ((minor)* 0x100) + ((major) *0x10000))
44-
#define FF_LIBRIST_VERSION FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR, LIBRIST_API_VERSION_MINOR, LIBRIST_API_VERSION_PATCH)
45-
#define FF_LIBRIST_VERSION_41 FF_LIBRIST_MAKE_VERSION(4, 1, 0)
46-
#define FF_LIBRIST_VERSION_42 FF_LIBRIST_MAKE_VERSION(4, 2, 0)
47-
4841
#define FIFO_SIZE_DEFAULT 8192
4942

5043
typedef struct RISTContext {
@@ -160,24 +153,14 @@ static int librist_open(URLContext *h, const char *uri, int flags)
160153
if (ret < 0)
161154
goto err;
162155

163-
#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
164-
ret = rist_parse_address(uri, (const struct rist_peer_config **)&peer_config);
165-
#else
166156
ret = rist_parse_address2(uri, &peer_config);
167-
#endif
168157
if (ret < 0)
169158
goto err;
170159

171160
if (flags & AVIO_FLAG_READ) {
172-
//Prior to 4.2.0 there was a bug in librist which made this call always fail.
173-
#if FF_LIBRIST_VERSION >= FF_LIBRIST_VERSION_42
174161
ret = rist_receiver_set_output_fifo_size(s->ctx, s->fifo_size);
175162
if (ret != 0)
176163
goto err;
177-
#else
178-
if (s->fifo_size != FIFO_SIZE_DEFAULT)
179-
av_log(h, AV_LOG_ERROR, "librist prior to 0.2.7 has a bug which fails setting the fifo buffer size\n");
180-
#endif
181164
}
182165

183166
if (((s->encryption == 128 || s->encryption == 256) && !s->secret) ||
@@ -219,13 +202,8 @@ static int librist_read(URLContext *h, uint8_t *buf, int size)
219202
RISTContext *s = h->priv_data;
220203
int ret;
221204

222-
#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
223-
const struct rist_data_block *data_block;
224-
ret = rist_receiver_data_read(s->ctx, &data_block, POLLING_TIME);
225-
#else
226205
struct rist_data_block *data_block;
227206
ret = rist_receiver_data_read2(s->ctx, &data_block, POLLING_TIME);
228-
#endif
229207

230208
if (ret < 0)
231209
return risterr2ret(ret);
@@ -234,15 +212,10 @@ static int librist_read(URLContext *h, uint8_t *buf, int size)
234212
return AVERROR(EAGAIN);
235213

236214
if (data_block->payload_len > MAX_PAYLOAD_SIZE) {
237-
#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
238-
rist_receiver_data_block_free((struct rist_data_block**)&data_block);
239-
#else
240215
rist_receiver_data_block_free2(&data_block);
241-
#endif
242216
return AVERROR_EXTERNAL;
243217
}
244218

245-
#if FF_LIBRIST_VERSION >= FF_LIBRIST_VERSION_42
246219
if (data_block->flags & RIST_DATA_FLAGS_OVERFLOW) {
247220
if (!s->overrun_nonfatal) {
248221
av_log(h, AV_LOG_ERROR, "Fifo buffer overrun. "
@@ -252,16 +225,11 @@ static int librist_read(URLContext *h, uint8_t *buf, int size)
252225
goto out_free;
253226
}
254227
}
255-
#endif
256228

257229
size = data_block->payload_len;
258230
memcpy(buf, data_block->payload, size);
259231
out_free:
260-
#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
261-
rist_receiver_data_block_free((struct rist_data_block**)&data_block);
262-
#else
263232
rist_receiver_data_block_free2(&data_block);
264-
#endif
265233
return size;
266234
}
267235

0 commit comments

Comments
 (0)