mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
module-rtp-source: use simple boolean to check activity
Avoid doing clock_gettime for each RTP packet and use a simple boolean to check if packets arrived since the last SAP timeout check.
This commit is contained in:
parent
7b3d02b7fa
commit
fab9d12a44
1 changed files with 11 additions and 4 deletions
|
|
@ -247,6 +247,7 @@ struct session {
|
||||||
float max_error;
|
float max_error;
|
||||||
unsigned buffering:1;
|
unsigned buffering:1;
|
||||||
unsigned first:1;
|
unsigned first:1;
|
||||||
|
unsigned receiving:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void stream_destroy(void *d)
|
static void stream_destroy(void *d)
|
||||||
|
|
@ -443,8 +444,8 @@ on_rtp_io(void *data, int fd, uint32_t mask)
|
||||||
filled, target_buffer);
|
filled, target_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sess->receiving = true;
|
||||||
}
|
}
|
||||||
session_touch(sess);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
receive_error:
|
receive_error:
|
||||||
|
|
@ -1100,10 +1101,16 @@ static void on_timer_event(void *data, uint64_t expirations)
|
||||||
|
|
||||||
spa_list_for_each_safe(sess, tmp, &impl->sessions, link) {
|
spa_list_for_each_safe(sess, tmp, &impl->sessions, link) {
|
||||||
if (sess->timestamp + interval < timestamp) {
|
if (sess->timestamp + interval < timestamp) {
|
||||||
pw_log_debug("More than %lu elapsed from last advertisement at %lu", interval, sess->timestamp);
|
pw_log_debug("More than %lu elapsed from last advertisement at %lu",
|
||||||
pw_log_info("No advertisement packets found for timeout, closing RTP source");
|
interval, sess->timestamp);
|
||||||
session_free(sess);
|
if (!sess->receiving) {
|
||||||
|
pw_log_info("SAP timeout, closing inactive RTP source");
|
||||||
|
session_free(sess);
|
||||||
|
} else {
|
||||||
|
pw_log_info("SAP timeout, keeping active RTP source");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
sess->receiving = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue