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

Function oh_decode_receive_frame

libavcodec/ohdec.c:636–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634}
635
636static int oh_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
637{
638 OHCodecDecContext *s = avctx->priv_data;
639
640 while (1) {
641 OHBufferQueueItem buffer = {0};
642 int ret;
643
644 // Try get output
645 ff_mutex_lock(&s->output_mutex);
646 while (!s->decode_status) {
647 if (av_fifo_read(s->output_queue, &buffer, 1) >= 0)
648 break;
649 // Only wait after send EOF
650 if (s->eof_sent && !s->decode_status)
651 ff_cond_wait(&s->output_cond, &s->output_mutex);
652 else
653 break;
654 }
655
656 ret = s->decode_status;
657 ff_mutex_unlock(&s->output_mutex);
658
659 // Got a frame
660 if (buffer.buffer)
661 return oh_decode_output_frame(avctx, frame, &buffer);
662 if (ret < 0)
663 return ret;
664
665 if (!s->pkt.size) {
666 /* fetch new packet or eof */
667 ret = ff_decode_get_packet(avctx, &s->pkt);
668 if (ret < 0 && ret != AVERROR_EOF)
669 return ret;
670 }
671
672 // Wait input buffer
673 ff_mutex_lock(&s->input_mutex);
674 while (!s->decode_status) {
675 if (av_fifo_read(s->input_queue, &buffer, 1) >= 0)
676 break;
677 ff_cond_wait(&s->input_cond, &s->input_mutex);
678 }
679
680 ret = s->decode_status;
681 ff_mutex_unlock(&s->input_mutex);
682
683 if (ret < 0)
684 return ret;
685
686 ret = oh_decode_send_pkt(avctx, &buffer);
687 if (ret < 0)
688 return ret;
689 }
690
691 return AVERROR(EAGAIN);
692}
693

Callers

nothing calls this directly

Calls 7

ff_mutex_lockFunction · 0.85
av_fifo_readFunction · 0.85
ff_cond_waitFunction · 0.85
ff_mutex_unlockFunction · 0.85
oh_decode_output_frameFunction · 0.85
ff_decode_get_packetFunction · 0.85
oh_decode_send_pktFunction · 0.85

Tested by

no test coverage detected