OSDN Git Service

Fix a hang in sync
[handbrake-jp/handbrake-jp-git.git] / libhb / encvorbis.c
index ce27ea0..609e45f 100644 (file)
@@ -47,7 +47,6 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
     hb_audio_t * audio = w->audio;
     int i;
     ogg_packet header[3];
-    struct ovectl_ratemanage2_arg  ctl_rate_arg;
 
     hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
     w->private_data = pv;
@@ -68,6 +67,12 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
     }
 
     /* init */
+    for( i = 0; i < 3; i++ )
+    {
+        // Zero vorbis headers so that we don't crash in mk_laceXiph
+        // when vorbis_encode_setup_managed fails.
+        memset( w->config->vorbis.headers[i], 0, sizeof( ogg_packet ) );
+    }
     vorbis_info_init( &pv->vi );
     if( vorbis_encode_setup_managed( &pv->vi, pv->out_discrete_channels,
           audio->config.out.samplerate, -1, 1000 * audio->config.out.bitrate, -1 ) )
@@ -77,15 +82,7 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
         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 ) ||
+    if( vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE2_SET, NULL ) ||
           vorbis_encode_setup_init( &pv->vi ) )
     {
         hb_error( "encvorbis: vorbis_encode_ctl( ratemanage2_set ) OR vorbis_encode_setup_init failed.\n" );