- job->arate, -1, 1000 * job->abitrate, -1 ) ||
- vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE_AVG, NULL ) ||
+ audio->config.out.samplerate, -1, 1000 * audio->config.out.bitrate, -1 ) )
+ {
+ hb_error( "encvorbis: vorbis_encode_setup_managed failed.\n" );
+ *job->die = 1;
+ return 0;
+ }
+
+ if( vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE2_GET, &ctl_rate_arg) )
+ {
+ hb_log( "encvorbis: vorbis_encode_ctl( ratemanage2_get ) failed" );
+ }
+
+ ctl_rate_arg.bitrate_average_kbps = audio->config.out.bitrate;
+ ctl_rate_arg.management_active = 1;
+
+ if( vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE2_SET, &ctl_rate_arg ) ||