diff options
author | Stian Selnes <stian@pexip.com> | 2016-10-18 11:09:10 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-11-01 20:18:14 +0200 |
commit | bcff182fd9bdbbd7912f0d84ec8136996b2c0ac6 (patch) | |
tree | 311e3ded754de573f77962eaa9d406ae10e2d156 | |
parent | 6e7816c589abd3f04eafa04694cc6ccb8943f7a3 (diff) |
rtph263pay: Fix leak for B-fragments
Altough commits 6a16be7, 64f9d08 and 0c7e3a8 fixed some issues they
introduced others. This patch fixes the leak of one macroblock for every
B fragment.
Macroblock structures must not be freed immediately after finding the
boundaries as they are stored and used later. However the inital dummy
structure (used for finding the first boundary) must be freed.
CID #1212156
https://bugzilla.gnome.org/show_bug.cgi?id=773512
-rw-r--r-- | gst/rtp/gstrtph263pay.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gst/rtp/gstrtph263pay.c b/gst/rtp/gstrtph263pay.c index 7ed2d6c1f..074d76377 100644 --- a/gst/rtp/gstrtph263pay.c +++ b/gst/rtp/gstrtph263pay.c @@ -970,9 +970,6 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context, GST_LOG ("current_pos:%p, end:%p, rest_bits:%d, window:%x", mac->start, mac->end, macroblock->ebit, context->window); - /* macroblock isn't needed anymore */ - gst_rtp_h263_pay_mb_destroy (macroblock); - GST_LOG ("Current pos after COD: %p", mac->end); if (context->piclayer->ptype_pictype == 0) { @@ -1412,7 +1409,7 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay, /*---------- MODE B MODE FRAGMENTATION ----------*/ - GstRtpH263PayMB *mac; + GstRtpH263PayMB *mac, *mac0; guint max_payload_size; GstRtpH263PayBoundry boundry; guint mb; @@ -1508,7 +1505,7 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay, // We are on MB layer - mac = gst_rtp_h263_pay_mb_new (&boundry, 0); + mac = mac0 = gst_rtp_h263_pay_mb_new (&boundry, 0); for (mb = 0; mb < format_props[context->piclayer->ptype_srcformat][1]; mb++) { GST_LOG ("================ START MB %d =================", mb); @@ -1520,9 +1517,12 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay, GST_LOG ("Error decoding MB - sbit: %d", 8 - ebit); GST_ERROR ("Error decoding in GOB"); + gst_rtp_h263_pay_mb_destroy (mac0); goto decode_error; } + /* Store macroblock for further processing and delete old MB if any */ + gst_rtp_h263_pay_mb_destroy (gob->macroblocks[mb]); gob->macroblocks[mb] = mac; //If mb_type == stuffing, don't increment the mb address @@ -1545,6 +1545,7 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay, mac->mba, mac->start, mac->end, mac->length, mac->sbit, mac->ebit); GST_LOG ("================ END MB %d =================", mb); } + gst_rtp_h263_pay_mb_destroy (mac0); mb = 0; first = 0; |