Pipewireパッケージ(ちょっと変更)
Revision | b094057b0b3502e1c25d3e429968d3bb8d919286 (tree) |
---|---|
Time | 2023-09-13 18:13:48 |
Author | Wim Taymans <wtaymans@redh...> |
Commiter | Wim Taymans |
handle NULL latency param
Fixes #3504
@@ -2442,7 +2442,6 @@ static int port_set_latency(struct client *c, struct port *p, | ||
2442 | 2442 | |
2443 | 2443 | if (param == NULL) |
2444 | 2444 | return 0; |
2445 | - | |
2446 | 2445 | if ((res = spa_latency_parse(param, &info)) < 0) |
2447 | 2446 | return res; |
2448 | 2447 |
@@ -691,7 +691,9 @@ impl_node_port_set_param(void *object, | ||
691 | 691 | case SPA_PARAM_Latency: |
692 | 692 | { |
693 | 693 | struct spa_latency_info info; |
694 | - if ((res = spa_latency_parse(param, &info)) < 0) | |
694 | + if (param == NULL) | |
695 | + info = SPA_LATENCY_INFO(SPA_DIRECTION_REVERSE(direction)); | |
696 | + else if ((res = spa_latency_parse(param, &info)) < 0) | |
695 | 697 | return res; |
696 | 698 | if (direction == info.direction) |
697 | 699 | return -EINVAL; |
@@ -572,7 +572,9 @@ impl_node_port_set_param(void *object, | ||
572 | 572 | case SPA_PARAM_Latency: |
573 | 573 | { |
574 | 574 | struct spa_latency_info info; |
575 | - if ((res = spa_latency_parse(param, &info)) < 0) | |
575 | + if (param == NULL) | |
576 | + info = SPA_LATENCY_INFO(SPA_DIRECTION_REVERSE(direction)); | |
577 | + else if ((res = spa_latency_parse(param, &info)) < 0) | |
576 | 578 | return res; |
577 | 579 | if (direction == info.direction) |
578 | 580 | return -EINVAL; |
@@ -572,7 +572,9 @@ impl_node_port_set_param(void *object, | ||
572 | 572 | case SPA_PARAM_Latency: |
573 | 573 | { |
574 | 574 | struct spa_latency_info info; |
575 | - if ((res = spa_latency_parse(param, &info)) < 0) | |
575 | + if (param == NULL) | |
576 | + info = SPA_LATENCY_INFO(SPA_DIRECTION_REVERSE(direction)); | |
577 | + else if ((res = spa_latency_parse(param, &info)) < 0) | |
576 | 578 | return res; |
577 | 579 | if (direction == info.direction) |
578 | 580 | return -EINVAL; |
@@ -729,7 +729,9 @@ static int impl_node_port_set_param(void *object, | ||
729 | 729 | case SPA_PARAM_Latency: |
730 | 730 | { |
731 | 731 | struct spa_latency_info info; |
732 | - if ((res = spa_latency_parse(param, &info)) < 0) | |
732 | + if (param == NULL) | |
733 | + info = SPA_LATENCY_INFO(SPA_DIRECTION_REVERSE(direction)); | |
734 | + else if ((res = spa_latency_parse(param, &info)) < 0) | |
733 | 735 | return res; |
734 | 736 | if (direction == info.direction) |
735 | 737 | return -EINVAL; |
@@ -697,7 +697,7 @@ static void stream_param_changed(void *d, uint32_t id, const struct spa_pod *par | ||
697 | 697 | update_delay(s->impl); |
698 | 698 | break; |
699 | 699 | case SPA_PARAM_Latency: |
700 | - if (!param) { | |
700 | + if (param == NULL) { | |
701 | 701 | s->have_latency = false; |
702 | 702 | } else if (spa_latency_parse(param, &latency) == 0 && |
703 | 703 | latency.direction == get_combine_direction(s->impl)) { |
@@ -604,7 +604,7 @@ static void input_param_latency_changed(struct impl *impl, const struct spa_pod | ||
604 | 604 | struct spa_pod_builder b; |
605 | 605 | const struct spa_pod *params[1]; |
606 | 606 | |
607 | - if (spa_latency_parse(param, &latency) < 0) | |
607 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
608 | 608 | return; |
609 | 609 | |
610 | 610 | spa_pod_builder_init(&b, buffer, sizeof(buffer)); |
@@ -767,7 +767,7 @@ static void output_param_latency_changed(struct impl *impl, const struct spa_pod | ||
767 | 767 | struct spa_pod_builder b; |
768 | 768 | const struct spa_pod *params[1]; |
769 | 769 | |
770 | - if (spa_latency_parse(param, &latency) < 0) | |
770 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
771 | 771 | return; |
772 | 772 | |
773 | 773 | spa_pod_builder_init(&b, buffer, sizeof(buffer)); |
@@ -227,7 +227,7 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param | ||
227 | 227 | struct spa_pod_builder b; |
228 | 228 | const struct spa_pod *params[1]; |
229 | 229 | |
230 | - if (spa_latency_parse(param, &latency) < 0) | |
230 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
231 | 231 | return; |
232 | 232 | |
233 | 233 | *info = latency; |
@@ -417,7 +417,7 @@ static void param_latency_changed(struct stream *s, const struct spa_pod *param, | ||
417 | 417 | bool update = false; |
418 | 418 | enum spa_direction direction = port->direction; |
419 | 419 | |
420 | - if (spa_latency_parse(param, &latency) < 0) | |
420 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
421 | 421 | return; |
422 | 422 | |
423 | 423 | if (spa_latency_info_compare(&port->latency[direction], &latency)) { |
@@ -410,7 +410,7 @@ static void param_latency_changed(struct stream *s, const struct spa_pod *param, | ||
410 | 410 | bool update = false; |
411 | 411 | enum spa_direction direction = port->direction; |
412 | 412 | |
413 | - if (spa_latency_parse(param, &latency) < 0) | |
413 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
414 | 414 | return; |
415 | 415 | |
416 | 416 | if (spa_latency_info_compare(&port->latency[direction], &latency)) { |
@@ -371,7 +371,7 @@ static void param_latency_changed(struct stream *s, const struct spa_pod *param, | ||
371 | 371 | bool update = false; |
372 | 372 | enum spa_direction direction = port->direction; |
373 | 373 | |
374 | - if (spa_latency_parse(param, &latency) < 0) | |
374 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
375 | 375 | return; |
376 | 376 | |
377 | 377 | if (spa_latency_info_compare(&port->latency[direction], &latency)) { |
@@ -493,7 +493,7 @@ static void param_latency_changed(struct stream *s, const struct spa_pod *param, | ||
493 | 493 | bool update = false; |
494 | 494 | enum spa_direction direction = port->direction; |
495 | 495 | |
496 | - if (spa_latency_parse(param, &latency) < 0) | |
496 | + if (param == NULL || spa_latency_parse(param, &latency) < 0) | |
497 | 497 | return; |
498 | 498 | |
499 | 499 | if (spa_latency_info_compare(&port->latency[direction], &latency)) { |