-
Notifications
You must be signed in to change notification settings - Fork 70
Move sample rate and sample format conversion utils into FFMPEGCommon.cpp
#629
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
Conversation
|
|
||
| UniqueAVFrame convertAudioAVFrameSampleFormatAndSampleRate( | ||
| const UniqueSwrContext& swrContext, | ||
| const UniqueAVFrame& srcAVFrame, |
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.
Nit: we should be consistent about src and source. I have a preference for src, as it's a universal abbreviation, particularly when paired with dst. But if we say source in a lot of other places, we should stick with that.
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.
Double nit, and I recognize this name already existed: convertAudioAVFrameSampleFormatAndSampleRate() is very long, and I feel like we're encoding parameter names that modify the operation into the name. I feel like it's clearer as just convertAudioAVFrame().
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.
Sounds good, I'll merge as-is and follow-up with a PR to address these
This PR moves the sample rate and sample format conversions utils from SingleStreamDecoder into FFMPEGCommon. Sample format conversion is needed for encoding too, so we need to make them common.
Specifically:
SingleStreamDecoder::createSwrContextis removed and its logic is not part of FFMPEGCommon'sallocateSwrContext, which was renamed intocreateSwrContextSingleStreamDecoder::convertAudioAVFrameSampleFormatAndSampleRateis moved tooInputs are slightly modified to account for the fact that there's no
streamInfo_anymore. Other than that, this is just copy/pasting code.