adaptivedemux2: Don't leak caps in debug statements
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-good / ext / adaptivedemux2 / gstadaptivedemux-stream.c
index 60eaceb..a7949be 100644 (file)
@@ -135,7 +135,7 @@ gst_adaptive_demux2_stream_finalize (GObject * object)
   if (stream->pending_caps)
     gst_caps_unref (stream->pending_caps);
 
-  g_clear_pointer (&stream->pending_tags, gst_tag_list_unref);
+  gst_clear_tag_list (&stream->pending_tags);
   g_clear_pointer (&stream->stream_collection, gst_object_unref);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -999,9 +999,8 @@ match_parsebin_to_track (GstAdaptiveDemux2Stream * stream, GstPad * pad)
   stream_type = gst_stream_get_stream_type (gst_stream);
 
   GST_DEBUG_OBJECT (pad,
-      "Trying to match pad from parsebin with internal streamid %s and caps %"
-      GST_PTR_FORMAT, GST_STR_NULL (internal_stream_id),
-      gst_stream_get_caps (gst_stream));
+      "Trying to match pad from parsebin with internal streamid %s and stream %"
+      GST_PTR_FORMAT, GST_STR_NULL (internal_stream_id), gst_stream);
 
   /* Try to match directly by the track's pending upstream_stream_id */
   for (tmp = stream->tracks; tmp; tmp = tmp->next) {
@@ -1941,7 +1940,7 @@ gst_adaptive_demux2_stream_next_download (GstAdaptiveDemux2Stream * stream)
 
     if (GST_CLOCK_STIME_IS_VALID (stream_time)) {
       /* TODO check return */
-      gst_adaptive_demux2_stream_seek (demux, stream, demux->segment.rate >= 0,
+      gst_adaptive_demux2_stream_seek (stream, demux->segment.rate >= 0,
           0, stream_time, &stream_time);
       stream->current_position = stream->start_position;
 
@@ -2197,6 +2196,20 @@ gst_adaptive_demux2_stream_has_next_fragment (GstAdaptiveDemux2Stream * stream)
   return ret;
 }
 
+/* must be called from the scheduler */
+GstFlowReturn
+gst_adaptive_demux2_stream_seek (GstAdaptiveDemux2Stream * stream,
+    gboolean forward, GstSeekFlags flags,
+    GstClockTimeDiff ts, GstClockTimeDiff * final_ts)
+{
+  GstAdaptiveDemux2StreamClass *klass =
+      GST_ADAPTIVE_DEMUX2_STREAM_GET_CLASS (stream);
+
+  if (klass->stream_seek)
+    return klass->stream_seek (stream, forward, flags, ts, final_ts);
+  return GST_FLOW_ERROR;
+}
+
 static gboolean
 gst_adaptive_demux2_stream_select_bitrate (GstAdaptiveDemux *
     demux, GstAdaptiveDemux2Stream * stream, guint64 bitrate)
@@ -2413,6 +2426,8 @@ can_handle_collection (GstAdaptiveDemux2Stream * stream,
       default:
         break;
     }
+    if (tags)
+      gst_tag_list_unref (tags);
   }
 
   /* Check that we either have at most 1 of each track type, or that