test: rtpbin_buffer_list: make check_packet more flexible
authorAntonio Ospite <antonio.ospite@collabora.com>
Wed, 6 Mar 2019 18:19:03 +0000 (19:19 +0100)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Mon, 1 Apr 2019 18:42:32 +0000 (18:42 +0000)
Make it possible to differentiate between the position in the list and
the packet index in the global structures in check_packet, in some
future case the list may change, in case some element removes a buffer
from the list, and the two indices may not coincide.

tests/check/elements/rtpbin_buffer_list.c

index c83d0fd..d241c6b 100644 (file)
@@ -210,20 +210,20 @@ check_payload (GstBuffer * buffer, guint index)
 }
 
 static void
-check_packet (GstBufferList * list, guint index)
+check_packet (GstBufferList * list, guint list_index, guint packet_index)
 {
   GstBuffer *buffer;
 
   fail_unless (list != NULL);
 
-  fail_unless ((buffer = gst_buffer_list_get (list, index)) != NULL);
+  fail_unless ((buffer = gst_buffer_list_get (list, list_index)) != NULL);
   fail_unless (gst_buffer_n_memory (buffer) == 2);
 
   fail_unless (GST_BUFFER_TIMESTAMP (buffer) ==
       GST_BUFFER_TIMESTAMP (original_buffer));
 
-  check_header (buffer, index);
-  check_payload (buffer, index);
+  check_header (buffer, packet_index);
+  check_payload (buffer, packet_index);
 }
 
 /*
@@ -257,10 +257,10 @@ sink_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
   fail_unless (gst_buffer_list_length (list) == 2);
 
   fail_unless (gst_buffer_list_get (list, 0));
-  check_packet (list, 0);
+  check_packet (list, 0, 0);
 
   fail_unless (gst_buffer_list_get (list, 1));
-  check_packet (list, 1);
+  check_packet (list, 1, 1);
 
   gst_buffer_list_unref (list);