@@ -492,7 +492,6 @@ static int filter_frame(cyanrip_ctx *ctx, cyanrip_enc_ctx **enc_ctx,
492
492
if (!dec_ctx -> filt .buffersrc_ctx )
493
493
return push_frame_to_encs (ctx , enc_ctx , num_enc , frame );
494
494
495
-
496
495
ret = av_buffersrc_add_frame_flags (dec_ctx -> filt .buffersrc_ctx , frame ,
497
496
AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT |
498
497
AV_BUFFERSRC_FLAG_KEEP_REF );
@@ -879,17 +878,14 @@ static void *cyanrip_track_encoding(void *ctx)
879
878
goto fail ;
880
879
}
881
880
882
- while (1 ) {
881
+ while (! atomic_load ( & s -> quit ) ) {
883
882
AVFrame * out_frame = NULL ;
884
883
885
884
if (!flushing ) {
886
885
out_frame = cr_frame_fifo_pop (s -> fifo );
887
886
flushing = !out_frame ;
888
887
}
889
888
890
- if (atomic_load (& s -> quit ))
891
- goto fail ;
892
-
893
889
ret = audio_process_frame (ctx , & out_frame , flushing );
894
890
if (ret == AVERROR (EAGAIN ))
895
891
continue ;
@@ -905,7 +901,7 @@ static void *cyanrip_track_encoding(void *ctx)
905
901
}
906
902
907
903
/* Return loop */
908
- while (1 ) {
904
+ while (! atomic_load ( & s -> quit ) ) {
909
905
ret = avcodec_receive_packet (s -> out_avctx , out_pkt );
910
906
if (ret == AVERROR_EOF ) {
911
907
ret = 0 ;
@@ -972,7 +968,7 @@ static void *cyanrip_track_encoding(void *ctx)
972
968
goto fail ;
973
969
}
974
970
975
- while ((out_pkt = cr_packet_fifo_pop (s -> packet_fifo ))) {
971
+ while (! atomic_load ( & s -> quit ) && (out_pkt = cr_packet_fifo_pop (s -> packet_fifo ))) {
976
972
/* Send frames to lavf */
977
973
ret = av_interleaved_write_frame (s -> avf , out_pkt );
978
974
av_packet_free (& out_pkt );
0 commit comments