change thread join strategy, fix a few leaks, fix a few bugs
[goodguy/history.git] / cinelerra-5.1 / cinelerra / ffmpeg.C
index 64acfe2bdbbd4a1026016eb65f8c1a0ddce033fa..515657867a22e929a0f806ec321bee6c1a63a9ac 100644 (file)
@@ -1992,8 +1992,8 @@ void FFMPEG::stop_muxer()
        if( running() ) {
                done = 1;
                mux_lock->unlock();
-               join();
        }
+       join();
 }
 
 void FFMPEG::flow_off()
@@ -2502,7 +2502,7 @@ printf("audio%d pad %ld %ld (%ld)\n", aud->idx, pos, aud->curr_pos, pos-aud->cur
                                int got_frame = 0;
                                int ret = aud->decode_frame(&pkt, frame, got_frame);
                                if( ret <= 0 ) break;
-                               if( got_frame ) {
+                               if( got_frame && frame->channels == nch ) {
                                        float *samples;
                                        int len = aud->get_samples(samples,
                                                 &frame->extended_data[0], frame->nb_samples);