mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
Improve memory handling
Reserve 0,0 for stack allocated mem that we never free Improve allocation in the link Parse format and properties in-line, there is no need to allocate memory. Improve buffer cleanup in alsa Add timestamps and offset to alsa
This commit is contained in:
parent
77f93e37ed
commit
27acab7532
7 changed files with 155 additions and 69 deletions
|
|
@ -318,15 +318,25 @@ mmap_read (SpaALSAState *state)
|
|||
|
||||
avail = snd_pcm_status_get_avail (status);
|
||||
snd_pcm_status_get_htstamp (status, &htstamp);
|
||||
now = (int64_t)htstamp.tv_sec * 1000000000ll + (int64_t)htstamp.tv_nsec;
|
||||
now = (int64_t)htstamp.tv_sec * SPA_NSEC_PER_SEC + (int64_t)htstamp.tv_nsec;
|
||||
|
||||
state->last_ticks = state->sample_count * SPA_USEC_PER_SEC / state->rate;
|
||||
state->last_monotonic = now;
|
||||
|
||||
SPA_QUEUE_POP_HEAD (&state->free, SpaALSABuffer, next, b);
|
||||
if (b == NULL) {
|
||||
fprintf (stderr, "no more buffers\n");
|
||||
} else {
|
||||
dest = b->ptr;
|
||||
if (b->h) {
|
||||
b->h->seq = state->sample_count;
|
||||
b->h->pts = state->last_monotonic;
|
||||
b->h->dts_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
state->sample_count += avail;
|
||||
|
||||
size = avail;
|
||||
while (size > 0) {
|
||||
frames = size;
|
||||
|
|
@ -358,6 +368,7 @@ mmap_read (SpaALSAState *state)
|
|||
size -= frames;
|
||||
}
|
||||
|
||||
|
||||
if (b) {
|
||||
SpaNodeEvent event;
|
||||
SpaNodeEventHaveOutput ho;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue