@@ -689,7 +689,6 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
//To be made sure it still applies
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = ctx->video_st->index;
- pkt.data = (uint8_t *)frameBytes;
pkt.size = videoFrame->GetRowBytes() *
videoFrame->GetHeight();
//fprintf(stderr,"Video Frame size %d ts %d\n", pkt.size, pkt.pts);
@@ -749,16 +748,16 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
txt_pkt.pts = pkt.pts;
txt_pkt.dts = pkt.dts;
txt_pkt.stream_index = ctx->teletext_st->index;
- txt_pkt.data = txt_buf0;
- txt_pkt.size = txt_buf - txt_buf0;
- if (avpacket_queue_put(&ctx->queue, &txt_pkt) < 0) {
+ if (av_packet_from_data(&txt_pkt, txt_buf0, txt_buf - txt_buf0) < 0 ||
+ avpacket_queue_put(&ctx->queue, &txt_pkt) < 0) {
++ctx->dropped;
}
}
}
}
- if (avpacket_queue_put(&ctx->queue, &pkt) < 0) {
+ if (av_packet_from_data(&pkt, (uint8_t *)frameBytes, pkt.size) < 0 ||
+ avpacket_queue_put(&ctx->queue, &pkt) < 0) {
++ctx->dropped;
}
}
@@ -779,9 +778,9 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
//fprintf(stderr,"Audio Frame size %d ts %d\n", pkt.size, pkt.pts);
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = ctx->audio_st->index;
- pkt.data = (uint8_t *)audioFrameBytes;
- if (avpacket_queue_put(&ctx->queue, &pkt) < 0) {
+ if (av_packet_from_data(&pkt, (uint8_t *)audioFrameBytes, pkt.size) < 0 ||
+ avpacket_queue_put(&ctx->queue, &pkt) < 0) {
++ctx->dropped;
}
}
As a side effect, the packets will now be refcounted. Signed-off-by: James Almer <jamrial@gmail.com> --- Untested libavdevice/decklink_dec.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)