mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
protection/harness/systemclock: move declaration out of for loop initialization
C90 compilers complain about it error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode Also run gst-indent on systemclock tests.
This commit is contained in:
parent
69f5d28718
commit
5b64123c54
3 changed files with 25 additions and 15 deletions
|
@ -203,8 +203,9 @@ gst_protection_factory_check (GstElementFactory * fact,
|
|||
GstStaticPadTemplate *templ = walk->data;
|
||||
GstCaps *caps = gst_static_pad_template_get_caps (templ);
|
||||
guint leng = gst_caps_get_size (caps);
|
||||
guint i, j;
|
||||
|
||||
for (guint i = 0; !retval && i < leng; ++i) {
|
||||
for (i = 0; !retval && i < leng; ++i) {
|
||||
GstStructure *st;
|
||||
|
||||
st = gst_caps_get_structure (caps, i);
|
||||
|
@ -214,7 +215,7 @@ gst_protection_factory_check (GstElementFactory * fact,
|
|||
gst_structure_get_string (st, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD);
|
||||
GST_DEBUG ("Found decryptor that supports protection system %s",
|
||||
sys_id);
|
||||
for (guint j = 0; !retval && system_identifiers[j]; ++j) {
|
||||
for (j = 0; !retval && system_identifiers[j]; ++j) {
|
||||
GST_TRACE (" compare with %s", system_identifiers[j]);
|
||||
if (g_ascii_strcasecmp (system_identifiers[j], sys_id) == 0) {
|
||||
GST_DEBUG (" Selecting %s", system_identifiers[j]);
|
||||
|
|
|
@ -2221,16 +2221,17 @@ gst_harness_src_crank_and_push_many (GstHarness * h, gint cranks, gint pushes)
|
|||
{
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gboolean crank;
|
||||
int i;
|
||||
|
||||
g_assert (h->src_harness);
|
||||
gst_harness_play (h->src_harness);
|
||||
|
||||
for (int i = 0; i < cranks; i++) {
|
||||
for (i = 0; i < cranks; i++) {
|
||||
crank = gst_harness_crank_single_clock_wait (h->src_harness);
|
||||
g_assert (crank);
|
||||
}
|
||||
|
||||
for (int i = 0; i < pushes; i++) {
|
||||
for (i = 0; i < pushes; i++) {
|
||||
GstBuffer *buf;
|
||||
buf = gst_harness_pull (h->src_harness);
|
||||
g_assert (buf != NULL);
|
||||
|
@ -2384,8 +2385,9 @@ GstFlowReturn
|
|||
gst_harness_sink_push_many (GstHarness * h, gint pushes)
|
||||
{
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
int i;
|
||||
g_assert (h->sink_harness);
|
||||
for (int i = 0; i < pushes; i++) {
|
||||
for (i = 0; i < pushes; i++) {
|
||||
ret = gst_harness_push_to_sink (h);
|
||||
if (ret != GST_FLOW_OK)
|
||||
break;
|
||||
|
|
|
@ -346,6 +346,7 @@ GST_START_TEST (test_async_order_stress_test)
|
|||
GList *cb_list = NULL, *cb_list_it;
|
||||
GstClockTime base;
|
||||
GstClockReturn result;
|
||||
unsigned int i;
|
||||
|
||||
clock = gst_system_clock_obtain ();
|
||||
fail_unless (clock != NULL, "Could not create instance of GstSystemClock");
|
||||
|
@ -357,7 +358,7 @@ GST_START_TEST (test_async_order_stress_test)
|
|||
* We expect the alarm thread to keep detecting the new entries and to
|
||||
* switch to wait on the first entry on the list
|
||||
*/
|
||||
for (unsigned int i = ALARM_COUNT; i > 0; --i) {
|
||||
for (i = ALARM_COUNT; i > 0; --i) {
|
||||
id[i - 1] = gst_clock_new_single_shot_id (clock, base + i * TIME_UNIT);
|
||||
result =
|
||||
gst_clock_id_wait_async (id[i - 1], store_callback, &cb_list, NULL);
|
||||
|
@ -373,7 +374,7 @@ GST_START_TEST (test_async_order_stress_test)
|
|||
* Will fail if alarm thread did not properly switch to wait on first entry
|
||||
* from the list
|
||||
*/
|
||||
for (unsigned int i = 0; i < ALARM_COUNT; ++i) {
|
||||
for (i = 0; i < ALARM_COUNT; ++i) {
|
||||
fail_unless (cb_list_it != NULL, "No notification received for id[%d]", i);
|
||||
fail_unless (cb_list_it->data == id[i],
|
||||
"Expected notification for id[%d]", i);
|
||||
|
@ -381,7 +382,7 @@ GST_START_TEST (test_async_order_stress_test)
|
|||
}
|
||||
g_mutex_unlock (&store_lock);
|
||||
|
||||
for (unsigned int i = 0; i < ALARM_COUNT; ++i)
|
||||
for (i = 0; i < ALARM_COUNT; ++i)
|
||||
gst_clock_id_unref (id[i]);
|
||||
g_list_free (cb_list);
|
||||
|
||||
|
@ -752,7 +753,8 @@ GST_START_TEST (test_resolution)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GThread *thread_wait;
|
||||
GThread *thread_unschedule;
|
||||
GMutex lock;
|
||||
|
@ -780,7 +782,8 @@ single_shot_wait_thread_func (gpointer data)
|
|||
|
||||
g_mutex_lock (&d->lock);
|
||||
d->unschedule = d->dont_unschedule_positive_offset ? offset < 0 : TRUE;
|
||||
id = d->id = gst_clock_new_single_shot_id (clock, now + (GstClockTime)offset);
|
||||
id = d->id =
|
||||
gst_clock_new_single_shot_id (clock, now + (GstClockTime) offset);
|
||||
g_mutex_unlock (&d->lock);
|
||||
|
||||
fail_unless (id != NULL, "Could not create single shot id");
|
||||
|
@ -819,8 +822,9 @@ unschedule_thread_func (gpointer data)
|
|||
GST_START_TEST (test_stress_cleanup_unschedule)
|
||||
{
|
||||
WaitUnscheduleData data[50];
|
||||
gint i;
|
||||
|
||||
for (gint i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
WaitUnscheduleData *d = &data[i];
|
||||
|
||||
/* Don't unschedule waits with positive offsets in order to trigger
|
||||
|
@ -844,7 +848,7 @@ GST_START_TEST (test_stress_cleanup_unschedule)
|
|||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
/* Stop and free test data */
|
||||
for (gint i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
WaitUnscheduleData *d = &data[i];
|
||||
d->running = FALSE;
|
||||
g_thread_join (d->thread_wait);
|
||||
|
@ -852,14 +856,16 @@ GST_START_TEST (test_stress_cleanup_unschedule)
|
|||
g_mutex_clear (&d->lock);
|
||||
}
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
GST_START_TEST (test_stress_reschedule)
|
||||
{
|
||||
WaitUnscheduleData data[50];
|
||||
gint i;
|
||||
|
||||
for (gint i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
WaitUnscheduleData *d = &data[i];
|
||||
|
||||
/* Try to unschedule all waits */
|
||||
|
@ -881,7 +887,7 @@ GST_START_TEST (test_stress_reschedule)
|
|||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
/* Stop and free test data */
|
||||
for (gint i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (data); i++) {
|
||||
WaitUnscheduleData *d = &data[i];
|
||||
d->running = FALSE;
|
||||
g_thread_join (d->thread_wait);
|
||||
|
@ -889,6 +895,7 @@ GST_START_TEST (test_stress_reschedule)
|
|||
g_mutex_clear (&d->lock);
|
||||
}
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue