-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed broken faststart when postprocessing AV1 recordings #3317
Merged
lminiero
merged 4 commits into
meetecho:master
from
corthiclem:fix/fix-faststart-av1-janus-pp-rec
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you're going through a
sprintf
here. Can't you justg_strdup(destination)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, thanks! Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget the
g_free(fctx->url);
that the commit you referenced includes, or you'll be introducing a leak. I see that patch also did a few other things for each codec, like settingCODEC_FLAG_GLOBAL_HEADER
: are those other changes unneeded for AV1 processing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am not wrong, the
avformat_free_context
function is used inpp_av1.c
when closing the file, which already frees the memory allocated (according to ffmpeg documentation), so there is no need forg_free(fctx->url)
.I think the patch just removed unused comments and that
CODEC_FLAG_GLOBAL_HEADER
flag was already there forH264
andH265
before the patch I mentionned. I can try to add the global header flag but I am not familiar enough withlibav
to know what will be the impact on the resulting video. I think it's not used either for WebM postprocessing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We allocate it ourselves with a
g_strdup
which is not compatible with theav_freep
that libavformat does. You have to free it yourself withg_free
and then set the pointer toNULL
, which is what the other patch did.I don't think it's on by default, and IIRC for H.264/H.265 it's needed for seeking and I can't remember what else. We're only saving AV1 to MP4 so WebM is irrelevant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I add
g_free
beforeavformat_free_context
, I do get afree(): double free detected in tcache 2
but it seems to be working fine if I add it after. I updated the pull request.What I could do is use
av_strdup
instead ofg_strdup
I guess.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because you ignored part of my previous message 🙂
You didn't set the pointer to
NULL
, soavformat_free_context
tries to free something that doesn't exist anymore.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, Monday mornings ... 😅
Will fix.
Concerning the global flag headers, I suggest doing it in another pull request as it requires a bit more work (creating a codec context and switching to a codec parameter which is not yet done for in
pp-av1
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem! I asked about the global flag header only because it was in the other patch, and so I wondered if it could be needed for AV1 too: it may very well be that it isn't, I rarely work with any AV1 recording at all so I don't have experience with them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new to AV1 recording, so I don't know if the global flag header helps but I'll take a deeper look at this as soon as I have time.