avtpcvfpay: Do not hide or modify gst_pad_push errors
Current code would change any non-ok return from gst_pad_push to GST_FLOW_ERROR, thus hiding meaningful returns such as GST_FLOW_EOS. Tests also added.
This commit is contained in:
parent
b09bc36160
commit
c45c235b2a
@ -483,22 +483,24 @@ gst_avtp_cvf_pay_prepare_avtp_packets (GstAvtpCvfPay * avtpcvfpay,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstFlowReturn
|
||||||
gst_avtp_cvf_pay_push_packets (GstAvtpCvfPay * avtpcvfpay,
|
gst_avtp_cvf_pay_push_packets (GstAvtpCvfPay * avtpcvfpay,
|
||||||
GPtrArray * avtp_packets)
|
GPtrArray * avtp_packets)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
GstFlowReturn ret;
|
||||||
GstAvtpBasePayload *avtpbasepayload = GST_AVTP_BASE_PAYLOAD (avtpcvfpay);
|
GstAvtpBasePayload *avtpbasepayload = GST_AVTP_BASE_PAYLOAD (avtpcvfpay);
|
||||||
|
|
||||||
for (i = 0; i < avtp_packets->len; i++) {
|
for (i = 0; i < avtp_packets->len; i++) {
|
||||||
GstBuffer *packet;
|
GstBuffer *packet;
|
||||||
|
|
||||||
packet = g_ptr_array_index (avtp_packets, i);
|
packet = g_ptr_array_index (avtp_packets, i);
|
||||||
if (gst_pad_push (avtpbasepayload->srcpad, packet) != GST_FLOW_OK)
|
ret = gst_pad_push (avtpbasepayload->srcpad, packet);
|
||||||
return FALSE;
|
if (ret != GST_FLOW_OK)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
@ -523,8 +525,7 @@ gst_avtp_cvf_pay_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||||||
avtp_packets = g_ptr_array_new ();
|
avtp_packets = g_ptr_array_new ();
|
||||||
gst_avtp_cvf_pay_prepare_avtp_packets (avtpcvfpay, nals, avtp_packets);
|
gst_avtp_cvf_pay_prepare_avtp_packets (avtpcvfpay, nals, avtp_packets);
|
||||||
|
|
||||||
if (!gst_avtp_cvf_pay_push_packets (avtpcvfpay, avtp_packets))
|
ret = gst_avtp_cvf_pay_push_packets (avtpcvfpay, avtp_packets);
|
||||||
ret = GST_FLOW_ERROR;
|
|
||||||
|
|
||||||
/* Contents of both ptr_arrays should be unref'd or transferred
|
/* Contents of both ptr_arrays should be unref'd or transferred
|
||||||
* to rightful owner by this point, no need to unref them again */
|
* to rightful owner by this point, no need to unref them again */
|
||||||
|
@ -137,6 +137,29 @@ compare_h264_avtpdu (struct avtp_stream_pdu *pdu, GstBuffer * buffer)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_START_TEST (test_payloader_downstream_eos)
|
||||||
|
{
|
||||||
|
GstHarness *h;
|
||||||
|
GstBuffer *in;
|
||||||
|
|
||||||
|
/* Create the harness for the avtpcvfpay */
|
||||||
|
h = gst_harness_new_parse
|
||||||
|
("avtpcvfpay streamid=0xAABBCCDDEEFF0001 mtt=1000000 tu=1000000 processing-deadline=0 ! fakesink num-buffers=1");
|
||||||
|
gst_harness_set_src_caps (h, generate_caps (4));
|
||||||
|
|
||||||
|
/* Buffer must have the nal len (4 bytes) and the nal (4 bytes) */
|
||||||
|
in = gst_harness_create_buffer (h, 8);
|
||||||
|
add_nal (in, 4, 1, 0);
|
||||||
|
GST_BUFFER_DTS (in) = 1000000;
|
||||||
|
GST_BUFFER_PTS (in) = 2000000;
|
||||||
|
|
||||||
|
fail_unless_equals_int (gst_harness_push (h, in), GST_FLOW_EOS);
|
||||||
|
|
||||||
|
gst_harness_teardown (h);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_payloader_zero_sized_nal)
|
GST_START_TEST (test_payloader_zero_sized_nal)
|
||||||
{
|
{
|
||||||
GstHarness *h;
|
GstHarness *h;
|
||||||
@ -674,6 +697,7 @@ avtpcvfpay_suite (void)
|
|||||||
tcase_add_test (tc_chain, test_payloader_properties);
|
tcase_add_test (tc_chain, test_payloader_properties);
|
||||||
tcase_add_test (tc_chain, test_payloader_no_codec_data);
|
tcase_add_test (tc_chain, test_payloader_no_codec_data);
|
||||||
tcase_add_test (tc_chain, test_payloader_zero_sized_nal);
|
tcase_add_test (tc_chain, test_payloader_zero_sized_nal);
|
||||||
|
tcase_add_test (tc_chain, test_payloader_downstream_eos);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user