@@ -1116,6 +1116,8 @@ static void upipe_avcdec_output_pic(struct upipe *upipe, struct upump **upump_p)
11161116 }
11171117 }
11181118
1119+ uref_free (upipe_avcdec -> uref );
1120+ upipe_avcdec -> uref = NULL ;
11191121 upipe_avcdec_output (upipe , uref , upump_p );
11201122}
11211123
@@ -1198,6 +1200,8 @@ static void upipe_avcdec_output_sound(struct upipe *upipe,
11981200 }
11991201 }
12001202
1203+ uref_free (upipe_avcdec -> uref );
1204+ upipe_avcdec -> uref = NULL ;
12011205 upipe_avcdec_output (upipe , uref , upump_p );
12021206}
12031207
@@ -1291,7 +1295,6 @@ static void upipe_avcdec_store_uref(struct upipe *upipe, struct uref *uref)
12911295 struct upipe_avcdec * upipe_avcdec = upipe_avcdec_from_upipe (upipe );
12921296 if (upipe_avcdec -> uref != NULL && upipe_avcdec -> uref -> uchain .next != NULL )
12931297 uref_free (uref_from_uchain (upipe_avcdec -> uref -> uchain .next ));
1294- uref_free (upipe_avcdec -> uref );
12951298 upipe_avcdec -> uref = uref ;
12961299}
12971300
@@ -1348,7 +1351,10 @@ static bool upipe_avcdec_decode(struct upipe *upipe, struct uref *uref,
13481351 upipe_avcdec -> input_dts_sys = input_dts_sys ;
13491352 }
13501353
1351- upipe_avcdec_store_uref (upipe , uref );
1354+ if (!upipe_avcdec -> uref )
1355+ upipe_avcdec_store_uref (upipe , uref );
1356+ else
1357+ uref_free (uref );
13521358 upipe_avcdec_decode_avpkt (upipe , & avpkt , upump_p );
13531359
13541360 free (avpkt .data );
0 commit comments