Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vidloop: fix packet_handler #29

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading