From baf72c9c39f48e9fe41cc0e2d9a501a21cb054cf Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Fri, 15 Sep 2023 09:48:51 +0200 Subject: [PATCH] vidloop: fix packet_handler --- modules/vidloop/vidloop.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c index 46ace72..2670944 100644 --- a/modules/vidloop/vidloop.c +++ b/modules/vidloop/vidloop.c @@ -250,9 +250,9 @@ static int display(struct video_loop *vl, struct vidframe *frame, static int packet_handler(bool marker, uint64_t rtp_ts, const uint8_t *hdr, size_t hdr_len, const uint8_t *pld, size_t pld_len, - void *arg) + const struct video *arg) { - struct video_loop *vl = arg; + struct video_loop *vl = (struct video_loop*)arg; struct vidframe frame; struct mbuf *mb; uint64_t timestamp; @@ -305,6 +305,18 @@ static int packet_handler(bool marker, uint64_t rtp_ts, } +static int packet_handler_h264(bool marker, uint64_t rtp_ts, + const uint8_t *hdr, size_t hdr_len, + const uint8_t *pld, size_t pld_len, + void *arg) +{ + return packet_handler(marker, rtp_ts, + hdr, hdr_len, + pld, pld_len, + arg); +} + + static void vidsrc_frame_handler(struct vidframe *frame, uint64_t timestamp, void *arg) { @@ -386,7 +398,7 @@ static void vidsrc_packet_handler(struct vidpacket *packet, void *arg) } h264_packetize(rtp_ts, packet->buf, packet->size, - 1480, packet_handler, vl); + 1480, packet_handler_h264, vl); } @@ -559,7 +571,7 @@ static int enable_encoder(struct video_loop *vl, const char *name) vl->vc_enc->name, prm.fps, prm.bitrate); err = vl->vc_enc->encupdh(&vl->enc, vl->vc_enc, &prm, NULL, - packet_handler, vl); + packet_handler, (struct video *)vl); if (err) { warning("vidloop: update encoder failed: %m\n", err); return err; @@ -583,7 +595,7 @@ static int enable_decoder(struct video_loop *vl, const char *name) info("vidloop: enabled decoder %s\n", vl->vc_dec->name); if (vl->vc_dec->decupdh) { - err = vl->vc_dec->decupdh(&vl->dec, vl->vc_dec, NULL); + err = vl->vc_dec->decupdh(&vl->dec, vl->vc_dec, NULL, NULL); if (err) { warning("vidloop: update decoder failed: %m\n", err); return err;