Showing the changes to libavdevice/decklink_dec.cpp (1 of 6 files). Show all
Unified · Split
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * Blackmagic DeckLink input |
| 3 | 3 | * Copyright (c) 2013-2014 Luca Barbato, Deti Fliegl |
| 4 | + * Copyright (c) 2017 Akamai Technologies, Inc. | |
| 4 | 5 | * |
| 5 | 6 | * This file is part of FFmpeg. |
| 6 | 7 | * |
| @@ -187,10 +188,12 @@ static uint8_t* teletext_data_unit_from_vanc_data(uint8_t *src, uint8_t *tgt, in · 180 unmodified lines | ||
| 187 | 188 | |
| 188 | 189 | static void avpacket_queue_init(AVFormatContext *avctx, AVPacketQueue *q) |
| 189 | 190 | { |
| 191 | + struct decklink_cctx *ctx = (struct decklink_cctx *)avctx->priv_data; | |
| 190 | 192 | memset(q, 0, sizeof(AVPacketQueue)); |
| 191 | 193 | pthread_mutex_init(&q->mutex, NULL); |
| 192 | 194 | pthread_cond_init(&q->cond, NULL); |
| 193 | 195 | q->avctx = avctx; |
| 196 | + q->max_q_size = ctx->queue_size; | |
| 194 | 197 | } |
| 195 | 198 | |
| 196 | 199 | static void avpacket_queue_flush(AVPacketQueue *q) |
| @@ -230,8 +233,8 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) · 33 unmodified lines | ||
| 230 | 233 | { |
| 231 | 234 | AVPacketList *pkt1; |
| 232 | 235 | |
| 233 | − // Drop Packet if queue size is > 1GB | |
| 234 | − if (avpacket_queue_size(q) > 1024 * 1024 * 1024 ) { | |
| 236 | + // Drop Packet if queue size is > maximum queue size | |
| 237 | + if (avpacket_queue_size(q) > q->max_q_size) { | |
| 235 | 238 | av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); |
| 236 | 239 | return -1; |
| 237 | 240 | } |