Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parent meta to compensated buffers #132

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

JassonRM
Copy link
Contributor

Adding parent meta to the compensated buffers avoided upstream bufferpools from trying to recycle the buffers before the memory was unreferenced. Solving issue #131.

@JassonRM JassonRM added the bug label Jul 13, 2022
@JassonRM JassonRM requested a review from michaelgruner July 13, 2022 16:09
@JassonRM JassonRM self-assigned this Jul 13, 2022
@JassonRM JassonRM linked an issue Jul 13, 2022 that may be closed by this pull request
@michaelgruner
Copy link
Collaborator

Thanks for the fix @JassonRM . However I don't understand how this fixes the original problem, the buffer is still not available, why isn't the pool allocating new buffers with this approach?

@michaelgruner michaelgruner changed the base branch from master to develop July 15, 2022 22:01
@JassonRM
Copy link
Contributor Author

@michaelgruner the problem was because the original buffer was unreferenced but the underlying memory wasn't. So the bufferpool would try to recycle the buffer right away but fail due to the memory being used. Adding the parent meta the buffer is only recycled once all the child buffers have been unreferenced. And there is no need to allocate more since the bufferpool contains enough to keep recycling them after they stopped being used.

@michaelgruner
Copy link
Collaborator

This should also be true for RESTART_TIMESTAMP isn't it?

@JassonRM
Copy link
Contributor Author

It is, I just added it. However, I was wondering why RESTART_TIMESTAMP never used gst_buffer_make_writable in the first place?

@michaelgruner
Copy link
Collaborator

It was an error, and it got past the reviews. Thanks for adding it.

@JassonRM
Copy link
Contributor Author

Hi @michaelgruner @rrcarlosrodriguez, to remind you I don't have permission to merge this pull request.

@dzhang28
Copy link

I think there might be some side-effect could be introduced by this change.

The gst_buffer_ref would increase the refcount of given buffer.
This could cause the gst_buffer_make_writable always return a copy of given buffer which in some case is unnecessary and might degrade peformance.

@migueltaylor migueltaylor merged commit b407bee into develop Jan 31, 2023
migueltaylor added a commit that referenced this pull request Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No reference kept to original buffer after compensating timestamps
7 participants