/* no wraparound when timestamps are increasing */
result = gst_rtp_buffer_ext_timestamp (&exttimestamp, 0);
- fail_unless_equals_uint64 (result, 0);
+ fail_unless_equals_uint64 (result, (G_GUINT64_CONSTANT (1) << 32) + 0);
result = gst_rtp_buffer_ext_timestamp (&exttimestamp, 10);
- fail_unless_equals_uint64 (result, 10);
+ fail_unless_equals_uint64 (result, (G_GUINT64_CONSTANT (1) << 32) + 10);
result = gst_rtp_buffer_ext_timestamp (&exttimestamp, 10);
- fail_unless_equals_uint64 (result, 10);
+ fail_unless_equals_uint64 (result, (G_GUINT64_CONSTANT (1) << 32) + 10);
result = gst_rtp_buffer_ext_timestamp (&exttimestamp,
G_GUINT64_CONSTANT (1) + G_MAXINT32);
- fail_unless_equals_uint64 (result, G_GUINT64_CONSTANT (1) + G_MAXINT32);
+ fail_unless_equals_uint64 (result,
+ (G_GUINT64_CONSTANT (1) << 32) + G_GUINT64_CONSTANT (1) + G_MAXINT32);
/* Even big bumps under G_MAXINT32 don't result in wrap-around */
exttimestamp = -1;
result = gst_rtp_buffer_ext_timestamp (&exttimestamp, 1087500);
- fail_unless_equals_uint64 (result, 1087500);
+ fail_unless_equals_uint64 (result, (G_GUINT64_CONSTANT (1) << 32) + 1087500);
result = gst_rtp_buffer_ext_timestamp (&exttimestamp, 24);
- fail_unless_equals_uint64 (result, 24);
+ fail_unless_equals_uint64 (result, (G_GUINT64_CONSTANT (1) << 32) + 24);
}
GST_END_TEST;
fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts,
G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)),
- (G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)));
+ ((G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 - 90000 +
+ G_GUINT64_CONSTANT (1)));
fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts, 0),
- G_MAXUINT32 + G_GUINT64_CONSTANT (1));
+ (G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 + G_GUINT64_CONSTANT (1));
fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000),
- (G_MAXUINT32 + G_GUINT64_CONSTANT (1) + 90000));
+ ((G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 + G_GUINT64_CONSTANT (1) +
+ 90000));
}
GST_END_TEST;
{
guint64 ext_ts = -1;
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts,
- G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1))
- == (G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)));
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts,
+ G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)),
+ (G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 - 90000 +
+ G_GUINT64_CONSTANT (1));
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts, 0)
- == G_MAXUINT32 + G_GUINT64_CONSTANT (1));
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts, 0),
+ (G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 + G_GUINT64_CONSTANT (1));
/* Unwrapping around */
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts,
- G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1))
- == (G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)));
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts,
+ G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)),
+ (G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 - 90000 +
+ G_GUINT64_CONSTANT (1));
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000)
- == (G_MAXUINT32 + G_GUINT64_CONSTANT (1) + 90000));
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000),
+ (G_GUINT64_CONSTANT (1) << 32) + G_MAXUINT32 + G_GUINT64_CONSTANT (1) +
+ 90000);
}
GST_END_TEST;
-GST_START_TEST (test_ext_timestamp_wraparound_disordered_cannot_unwrap)
+GST_START_TEST (test_ext_timestamp_wraparound_disordered_backwards)
{
guint64 ext_ts = -1;
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000)
- == 90000);
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000),
+ (G_GUINT64_CONSTANT (1) << 32) + 90000);
- /* Cannot unwrapping around */
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts,
- G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)) == 0);
+ /* Wraps backwards */
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts,
+ G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1)),
+ G_MAXUINT32 - 90000 + G_GUINT64_CONSTANT (1));
- fail_unless (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000)
- == 90000);
+ fail_unless_equals_uint64 (gst_rtp_buffer_ext_timestamp (&ext_ts, 90000),
+ (G_GUINT64_CONSTANT (1) << 32) + 90000);
}
GST_END_TEST;
tcase_add_test (tc_chain, test_ext_timestamp_basic);
tcase_add_test (tc_chain, test_ext_timestamp_wraparound);
tcase_add_test (tc_chain, test_ext_timestamp_wraparound_disordered);
- tcase_add_test (tc_chain,
- test_ext_timestamp_wraparound_disordered_cannot_unwrap);
+ tcase_add_test (tc_chain, test_ext_timestamp_wraparound_disordered_backwards);
tcase_add_test (tc_chain, test_rtcp_compound_padding);
tcase_add_test (tc_chain, test_rtp_buffer_extlen_wraparound);