summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2015-09-19 17:04:07 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-09-20 10:13:38 +0200
commit2d7bfc13141ad751e2de833b85efa11a2b8a52ef (patch)
treec4823955408c19d19fcda9f76bed5f414a9f9051
parent869e21bd82c413425e3fa4d959c2ff3f3b0f9430 (diff)
downloadgstreamer-plugins-good-2d7bfc13141ad751e2de833b85efa11a2b8a52ef.tar.gz
rtp{vorbis,theora}{pay,depay}: Cosmetic cleanup
* use g_list_free_full(), don't iterate elements maually when freeing * call gst_rtp_*_pay_clear_packet(), don't duplicate its code * use gst_buffer_unref() to clarify that it is buffers being released, instead of refering directly to gst_mini_object_unref() Fixes https://bugzilla.gnome.org/show_bug.cgi?id=755277
-rw-r--r--gst/rtp/gstrtptheorapay.c21
-rw-r--r--gst/rtp/gstrtpvorbisdepay.c16
-rw-r--r--gst/rtp/gstrtpvorbispay.c19
3 files changed, 12 insertions, 44 deletions
diff --git a/gst/rtp/gstrtptheorapay.c b/gst/rtp/gstrtptheorapay.c
index cf5c48552..802a335af 100644
--- a/gst/rtp/gstrtptheorapay.c
+++ b/gst/rtp/gstrtptheorapay.c
@@ -153,22 +153,17 @@ gst_rtp_theora_pay_clear_packet (GstRtpTheoraPay * rtptheorapay)
if (rtptheorapay->packet)
gst_buffer_unref (rtptheorapay->packet);
rtptheorapay->packet = NULL;
-
- g_list_foreach (rtptheorapay->packet_buffers, (GFunc) gst_mini_object_unref,
- NULL);
- g_list_free (rtptheorapay->packet_buffers);
+ g_list_free_full (rtptheorapay->packet_buffers,
+ (GDestroyNotify) gst_buffer_unref);
rtptheorapay->packet_buffers = NULL;
}
static void
gst_rtp_theora_pay_cleanup (GstRtpTheoraPay * rtptheorapay)
{
- g_list_foreach (rtptheorapay->headers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (rtptheorapay->headers);
- rtptheorapay->headers = NULL;
-
gst_rtp_theora_pay_clear_packet (rtptheorapay);
-
+ g_list_free_full (rtptheorapay->headers, (GDestroyNotify) gst_buffer_unref);
+ rtptheorapay->headers = NULL;
if (rtptheorapay->config_data)
g_free (rtptheorapay->config_data);
rtptheorapay->config_data = NULL;
@@ -283,13 +278,7 @@ gst_rtp_theora_pay_init_packet (GstRtpTheoraPay * rtptheorapay, guint8 TDT,
{
GST_DEBUG_OBJECT (rtptheorapay, "starting new packet, TDT: %d", TDT);
- if (rtptheorapay->packet)
- gst_buffer_unref (rtptheorapay->packet);
-
- g_list_foreach (rtptheorapay->packet_buffers, (GFunc) gst_mini_object_unref,
- NULL);
- g_list_free (rtptheorapay->packet_buffers);
- rtptheorapay->packet_buffers = NULL;
+ gst_rtp_theora_pay_clear_packet (rtptheorapay);
/* new packet allocate max packet size */
rtptheorapay->packet =
diff --git a/gst/rtp/gstrtpvorbisdepay.c b/gst/rtp/gstrtpvorbisdepay.c
index bc13a04e1..bd2f78faf 100644
--- a/gst/rtp/gstrtpvorbisdepay.c
+++ b/gst/rtp/gstrtpvorbisdepay.c
@@ -113,26 +113,14 @@ gst_rtp_vorbis_depay_init (GstRtpVorbisDepay * rtpvorbisdepay)
static void
free_config (GstRtpVorbisConfig * conf)
{
- GList *headers;
-
- for (headers = conf->headers; headers; headers = g_list_next (headers)) {
- GstBuffer *header = GST_BUFFER_CAST (headers->data);
-
- gst_buffer_unref (header);
- }
- g_list_free (conf->headers);
+ g_list_free_full (conf->headers, (GDestroyNotify) gst_buffer_unref);
g_free (conf);
}
static void
free_indents (GstRtpVorbisDepay * rtpvorbisdepay)
{
- GList *walk;
-
- for (walk = rtpvorbisdepay->configs; walk; walk = g_list_next (walk)) {
- free_config ((GstRtpVorbisConfig *) walk->data);
- }
- g_list_free (rtpvorbisdepay->configs);
+ g_list_free_full (rtpvorbisdepay->configs, (GDestroyNotify) free_config);
rtpvorbisdepay->configs = NULL;
}
diff --git a/gst/rtp/gstrtpvorbispay.c b/gst/rtp/gstrtpvorbispay.c
index bd8ee416d..43507056f 100644
--- a/gst/rtp/gstrtpvorbispay.c
+++ b/gst/rtp/gstrtpvorbispay.c
@@ -145,21 +145,17 @@ gst_rtp_vorbis_pay_clear_packet (GstRtpVorbisPay * rtpvorbispay)
if (rtpvorbispay->packet)
gst_buffer_unref (rtpvorbispay->packet);
rtpvorbispay->packet = NULL;
- g_list_foreach (rtpvorbispay->packet_buffers, (GFunc) gst_mini_object_unref,
- NULL);
- g_list_free (rtpvorbispay->packet_buffers);
+ g_list_free_full (rtpvorbispay->packet_buffers,
+ (GDestroyNotify) gst_buffer_unref);
rtpvorbispay->packet_buffers = NULL;
}
static void
gst_rtp_vorbis_pay_cleanup (GstRtpVorbisPay * rtpvorbispay)
{
- g_list_foreach (rtpvorbispay->headers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (rtpvorbispay->headers);
- rtpvorbispay->headers = NULL;
-
gst_rtp_vorbis_pay_clear_packet (rtpvorbispay);
-
+ g_list_free_full (rtpvorbispay->headers, (GDestroyNotify) gst_buffer_unref);
+ rtpvorbispay->headers = NULL;
if (rtpvorbispay->config_data)
g_free (rtpvorbispay->config_data);
rtpvorbispay->config_data = NULL;
@@ -277,12 +273,7 @@ gst_rtp_vorbis_pay_init_packet (GstRtpVorbisPay * rtpvorbispay, guint8 VDT,
{
GST_LOG_OBJECT (rtpvorbispay, "starting new packet, VDT: %d", VDT);
- if (rtpvorbispay->packet)
- gst_buffer_unref (rtpvorbispay->packet);
- g_list_foreach (rtpvorbispay->packet_buffers, (GFunc) gst_mini_object_unref,
- NULL);
- g_list_free (rtpvorbispay->packet_buffers);
- rtpvorbispay->packet_buffers = NULL;
+ gst_rtp_vorbis_pay_clear_packet (rtpvorbispay);
/* new packet allocate max packet size */
rtpvorbispay->packet =