Refactor the initialization of EncodeProcess (#3205)
Summary: Pull Request resolved: https://github.com/pytorch/audio/pull/3205 This commit refactors the initialization of EncodeProcess. Interface-wise, the signature of the constructor of EncodeProcess has made simpler just to take rvalues of its components, and the initialization of the components have been moved to helper functions. Implementat-wise, the order that the components are initialized is revised, and the source of initialization parameters is also revised. For example, the original implementation first creates AVCodecContext, and passes it around to create the other components. This relied on an assumption that parameters AVCodecContext has (such as image size and sample rate) are same as the source data. This is not always right, and as we will introduce custom filter graph and allow on-the-fly transform of rates and dimensions, it will become even less correct. The new initialization constructs source AVFrame, TensorConverter and FilterGraph from source attributes. This makes it easy to introduce on-the-fly transform. Reviewed By: nateanl Differential Revision: D44360650 fbshipit-source-id: bf0e77dc1a5a40fc8e9870c50d07339d812762e8
Showing
This diff is collapsed.
Please register or sign in to comment