Giter VIP home page Giter VIP logo

Comments (7)

JeffyCN avatar JeffyCN commented on May 28, 2024

could not reproduce this issue...

the only part of this commit that might affect the decoding flow is in rkmpp_dqbuf(), but it looks fine

from libv4l-rkmpp.

JeffyCN avatar JeffyCN commented on May 28, 2024

maybe we can try to compare the v4l-rkmpp's verbose logs.

from libv4l-rkmpp.

amazingfate avatar amazingfate commented on May 28, 2024

Here are the logs with env LIBV4L_RKMPP_LOG_LEVEL=7
rkmpp_fine.log.gz
rkmpp_slow.log.gz

from libv4l-rkmpp.

amazingfate avatar amazingfate commented on May 28, 2024

reverting changes to rkmpp_dqbuf would solve it.

diff --git a/src/libv4l-rkmpp.c b/src/libv4l-rkmpp.c
index 7ad4b53..9ddbf69 100644
--- a/src/libv4l-rkmpp.c
+++ b/src/libv4l-rkmpp.c
@@ -669,6 +669,7 @@ int rkmpp_dqbuf(struct rkmpp_context *ctx, struct v4l2_buffer *buffer)

        pthread_mutex_lock(&queue->queue_mutex);
        rkmpp_buffer = TAILQ_FIRST(&queue->avail_buffers);
+       TAILQ_REMOVE(&queue->avail_buffers, rkmpp_buffer, entry);
        pthread_mutex_unlock(&queue->queue_mutex);

        /* Update poll event after avail list changed */
@@ -680,10 +681,11 @@ int rkmpp_dqbuf(struct rkmpp_context *ctx, struct v4l2_buffer *buffer)
                RETURN_ERR(EINVAL, -1);
        }

-       pthread_mutex_lock(&queue->queue_mutex);
+       if (rkmpp_buffer_keyframe(rkmpp_buffer))
+               rkmpp_buffer_clr_keyframe(rkmpp_buffer);
+       if (rkmpp_buffer_error(rkmpp_buffer))
+               rkmpp_buffer_clr_error(rkmpp_buffer);
        rkmpp_buffer_clr_available(rkmpp_buffer);
-       TAILQ_REMOVE(&queue->avail_buffers, rkmpp_buffer, entry);
-       pthread_mutex_unlock(&queue->queue_mutex);

        rkmpp_buffer_clr_queued(rkmpp_buffer);

from libv4l-rkmpp.

amazingfate avatar amazingfate commented on May 28, 2024

And a smaller patch to fix:

diff --git a/src/libv4l-rkmpp.c b/src/libv4l-rkmpp.c
index 7ad4b53..0179b92 100644
--- a/src/libv4l-rkmpp.c
+++ b/src/libv4l-rkmpp.c
@@ -669,6 +669,7 @@ int rkmpp_dqbuf(struct rkmpp_context *ctx, struct v4l2_buffer *buffer)

        pthread_mutex_lock(&queue->queue_mutex);
        rkmpp_buffer = TAILQ_FIRST(&queue->avail_buffers);
+       TAILQ_REMOVE(&queue->avail_buffers, rkmpp_buffer, entry);
        pthread_mutex_unlock(&queue->queue_mutex);

        /* Update poll event after avail list changed */
@@ -682,7 +683,6 @@ int rkmpp_dqbuf(struct rkmpp_context *ctx, struct v4l2_buffer *buffer)

        pthread_mutex_lock(&queue->queue_mutex);
        rkmpp_buffer_clr_available(rkmpp_buffer);
-       TAILQ_REMOVE(&queue->avail_buffers, rkmpp_buffer, entry);
        pthread_mutex_unlock(&queue->queue_mutex);

        rkmpp_buffer_clr_queued(rkmpp_buffer);

from libv4l-rkmpp.

JeffyCN avatar JeffyCN commented on May 28, 2024

huh, there's indeed a mistake around there, try:

--- a/src/libv4l-rkmpp.c
+++ b/src/libv4l-rkmpp.c
@@ -671,9 +671,6 @@ int rkmpp_dqbuf(struct rkmpp_context *ctx, struct v4l2_buffer *buffer)
        rkmpp_buffer = TAILQ_FIRST(&queue->avail_buffers);
        pthread_mutex_unlock(&queue->queue_mutex);

-       /* Update poll event after avail list changed */
-       rkmpp_update_poll_event(ctx);
-
        ret = rkmpp_to_v4l2_buffer(ctx, rkmpp_buffer, buffer);
        if (ret < 0) {
                LOGE("failed to convert buffer\n");
@@ -687,6 +684,9 @@ int rkmpp_dqbuf(struct rkmpp_context *ctx, struct v4l2_buffer *buffer)

        rkmpp_buffer_clr_queued(rkmpp_buffer);

+       /* Update poll event after avail list changed */
+       rkmpp_update_poll_event(ctx);
+
        LOGV(2, "dequeue buffer: %d(%" PRIu64 "), size: %d, type: %d\n",
             buffer->index, rkmpp_buffer->timestamp,
             rkmpp_buffer->bytesused, buffer->type);

from libv4l-rkmpp.

amazingfate avatar amazingfate commented on May 28, 2024

Yes that does fix my issue!

from libv4l-rkmpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.