Skip to content

Commit

Permalink
vidloop: fix packet_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Sep 15, 2023
1 parent 075d94f commit 0224c4e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions modules/vidloop/vidloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}


Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 0224c4e

Please sign in to comment.