File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -776,17 +776,17 @@ impl Encoder {
776776 }
777777
778778 unsafe {
779- if self . previous_dimensions . is_none ( ) {
780- // First time we call initialize_ext
781- self . raw_api . initialize_ext ( & raw const params) . ok ( ) ?;
782- self . raw_api . set_option ( ENCODER_OPTION_TRACE_LEVEL , addr_of_mut ! ( self . config. debug) . cast ( ) ) . ok ( ) ?;
783- self . raw_api . set_option ( ENCODER_OPTION_DATAFORMAT , addr_of_mut ! ( self . config. data_format) . cast ( ) ) . ok ( ) ?;
784- } else {
779+ if self . is_initialized ( ) {
785780 // Subsequent times we call SetOption
786781 self . raw_api . set_option ( ENCODER_OPTION_SVC_ENCODE_PARAM_EXT , addr_of_mut ! ( params) . cast ( ) ) . ok ( ) ?;
787782
788783 // Start with a new keyframe after dimensions changed.
789784 self . force_intra_frame ( ) ;
785+ } else {
786+ // First time we call initialize_ext
787+ self . raw_api . initialize_ext ( & raw const params) . ok ( ) ?;
788+ self . raw_api . set_option ( ENCODER_OPTION_TRACE_LEVEL , addr_of_mut ! ( self . config. debug) . cast ( ) ) . ok ( ) ?;
789+ self . raw_api . set_option ( ENCODER_OPTION_DATAFORMAT , addr_of_mut ! ( self . config. data_format) . cast ( ) ) . ok ( ) ?;
790790 }
791791 }
792792
@@ -802,6 +802,10 @@ impl Encoder {
802802 }
803803 }
804804
805+ const fn is_initialized ( & self ) -> bool {
806+ self . previous_dimensions . is_some ( )
807+ }
808+
805809 /// Obtain the raw API for advanced use cases.
806810 ///
807811 /// When resorting to this call, please consider filing an issue / PR.
You can’t perform that action at this time.
0 commit comments