diff mbox series

[FFmpeg-devel,v3,1/2] decklink: move queue_size to an argument for ff_decklink_packet_queue_init

Message ID 1688159679-3623-1-git-send-email-dheitmueller@ltnglobal.com
State New
Headers show
Series [FFmpeg-devel,v3,1/2] decklink: move queue_size to an argument for ff_decklink_packet_queue_init | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Devin Heitmueller June 30, 2023, 9:14 p.m. UTC
The existing queue initialization function would always sets it's
maximum queue size to ctx->queue_size.  But because we are introducing
more queues we may want the sizes to differ between them.

Move the specification of the queue size into an argument, which can
be passed from the caller.

This patch makes no functional change to the behavior.  It is being
made to accommodate Marton Balin's request to split out the queue
size for the new VANC queue being introduced in a later patch.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
 libavdevice/decklink_common.cpp | 4 ++--
 libavdevice/decklink_common.h   | 2 +-
 libavdevice/decklink_dec.cpp    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Marton Balint July 2, 2023, 4:10 p.m. UTC | #1
On Fri, 30 Jun 2023, Devin Heitmueller wrote:

> The existing queue initialization function would always sets it's
> maximum queue size to ctx->queue_size.  But because we are introducing
> more queues we may want the sizes to differ between them.
>
> Move the specification of the queue size into an argument, which can
> be passed from the caller.
>
> This patch makes no functional change to the behavior.  It is being
> made to accommodate Marton Balin's request to split out the queue
> size for the new VANC queue being introduced in a later patch.
>
> Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
> ---
> libavdevice/decklink_common.cpp | 4 ++--
> libavdevice/decklink_common.h   | 2 +-
> libavdevice/decklink_dec.cpp    | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
> index b6cc8d7..5e8d612 100644
> --- a/libavdevice/decklink_common.cpp
> +++ b/libavdevice/decklink_common.cpp
> @@ -390,14 +390,14 @@ int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t directio
>     return ff_decklink_set_format(avctx, 0, 0, 0, 0, AV_FIELD_UNKNOWN, direction);
> }
>
> -void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q)
> +void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q, int64_t queue_size)
> {
>     struct decklink_cctx *ctx = (struct decklink_cctx *)avctx->priv_data;

This is now unused.

>     memset(q, 0, sizeof(DecklinkPacketQueue));
>     pthread_mutex_init(&q->mutex, NULL);
>     pthread_cond_init(&q->cond, NULL);
>     q->avctx = avctx;
> -    q->max_q_size = ctx->queue_size;
> +    q->max_q_size = queue_size;
> }

Will apply with the change above.

Thanks,
Marton
diff mbox series

Patch

diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index b6cc8d7..5e8d612 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -390,14 +390,14 @@  int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t directio
     return ff_decklink_set_format(avctx, 0, 0, 0, 0, AV_FIELD_UNKNOWN, direction);
 }
 
-void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q)
+void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q, int64_t queue_size)
 {
     struct decklink_cctx *ctx = (struct decklink_cctx *)avctx->priv_data;
     memset(q, 0, sizeof(DecklinkPacketQueue));
     pthread_mutex_init(&q->mutex, NULL);
     pthread_cond_init(&q->cond, NULL);
     q->avctx = avctx;
-    q->max_q_size = ctx->queue_size;
+    q->max_q_size = queue_size;
 }
 
 void ff_decklink_packet_queue_flush(DecklinkPacketQueue *q)
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index ebb5b94..53e9983 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -235,7 +235,7 @@  int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct
 void ff_decklink_cleanup(AVFormatContext *avctx);
 int ff_decklink_init_device(AVFormatContext *avctx, const char* name);
 
-void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q);
+void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q, int64_t queue_size);
 void ff_decklink_packet_queue_flush(DecklinkPacketQueue *q);
 void ff_decklink_packet_queue_end(DecklinkPacketQueue *q);
 unsigned long long ff_decklink_packet_queue_size(DecklinkPacketQueue *q);
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 66abee1..11640f7 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -1297,7 +1297,7 @@  av_cold int ff_decklink_read_header(AVFormatContext *avctx)
         goto error;
     }
 
-    ff_decklink_packet_queue_init(avctx, &ctx->queue);
+    ff_decklink_packet_queue_init(avctx, &ctx->queue, cctx->queue_size);
 
     if (ctx->dli->StartStreams() != S_OK) {
         av_log(avctx, AV_LOG_ERROR, "Cannot start input stream\n");