MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_decklink_packet_queue_put

Function ff_decklink_packet_queue_put

libavdevice/decklink_common.cpp:436–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436int ff_decklink_packet_queue_put(DecklinkPacketQueue *q, AVPacket *pkt)
437{
438 int pkt_size = pkt->size;
439 int ret;
440
441 // Drop Packet if queue size is > maximum queue size
442 if (ff_decklink_packet_queue_size(q) > (uint64_t)q->max_q_size) {
443 av_packet_unref(pkt);
444 av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n");
445 return -1;
446 }
447 /* ensure the packet is reference counted */
448 if (av_packet_make_refcounted(pkt) < 0) {
449 av_packet_unref(pkt);
450 return -1;
451 }
452
453 pthread_mutex_lock(&q->mutex);
454
455 ret = avpriv_packet_list_put(&q->pkt_list, pkt, NULL, 0);
456 if (ret == 0) {
457 q->nb_packets++;
458 q->size += pkt_size + sizeof(AVPacket);
459 pthread_cond_signal(&q->cond);
460 } else {
461 av_packet_unref(pkt);
462 }
463
464 pthread_mutex_unlock(&q->mutex);
465 return ret;
466}
467
468int ff_decklink_packet_queue_get(DecklinkPacketQueue *q, AVPacket *pkt, int block)
469{

Callers 3

handle_klvFunction · 0.85

Calls 8

av_packet_unrefFunction · 0.85
av_logFunction · 0.85
avpriv_packet_list_putFunction · 0.85
pthread_mutex_lockFunction · 0.50
pthread_cond_signalFunction · 0.50
pthread_mutex_unlockFunction · 0.50

Tested by

no test coverage detected