2023-02-08 18:12:00 +01:00
|
|
|
/* PipeWire */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2020 Wim Taymans */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
2020-11-13 18:19:56 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
#include <stdlib.h>
|
2020-11-13 18:19:56 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
#include <pipewire/log.h>
|
|
|
|
|
#include <pipewire/map.h>
|
|
|
|
|
#include <pipewire/properties.h>
|
2020-11-13 18:19:56 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
#include "internal.h"
|
2021-09-22 09:28:54 +10:00
|
|
|
#include "log.h"
|
2021-06-18 22:23:53 +02:00
|
|
|
#include "sample.h"
|
2020-11-15 21:02:49 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
void sample_free(struct sample *sample)
|
2020-11-15 21:02:49 +01:00
|
|
|
{
|
2021-06-18 22:23:53 +02:00
|
|
|
struct impl * const impl = sample->impl;
|
2020-11-15 21:02:49 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
pw_log_info("free sample id:%u name:%s", sample->index, sample->name);
|
2020-11-15 21:02:49 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
impl->stat.sample_cache -= sample->length;
|
2021-01-21 13:39:54 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
if (sample->index != SPA_ID_INVALID)
|
|
|
|
|
pw_map_remove(&impl->samples, sample->index);
|
2020-11-13 18:19:56 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
pw_properties_free(sample->props);
|
2020-11-13 18:19:56 +01:00
|
|
|
|
2021-06-18 22:23:53 +02:00
|
|
|
free(sample->buffer);
|
|
|
|
|
free(sample);
|
2020-11-13 18:19:56 +01:00
|
|
|
}
|