picture_pool: remove unused Reserve function

It was useful in the past when the vout was allocating buffers once. We don't
need this trick anymore.
This commit is contained in:
Steve Lhomme 2023-07-28 08:48:10 +02:00 committed by Jean-Baptiste Kempf
parent 53c21ea2ba
commit ed8f57fa28
4 changed files with 1 additions and 73 deletions

View File

@ -104,22 +104,4 @@ VLC_API picture_t * picture_pool_Get( picture_pool_t * ) VLC_USED;
*/
VLC_API picture_t *picture_pool_Wait(picture_pool_t *) VLC_USED;
/**
* Reserves pictures from a pool and creates a new pool with those.
*
* When the new pool is released, pictures are returned to the master pool.
* If the master pool was already released, pictures will be destroyed.
*
* @param pool A pool from ::picture_pool_New or ::picture_pool_NewFromFormat
* @param count number of picture to reserve
*
* @return the new pool, or NULL if there were not enough pictures available
* or on error
*
* @note This function is thread-safe (but it might return NULL if other
* threads have already allocated too many pictures).
*/
VLC_API picture_pool_t * picture_pool_Reserve(picture_pool_t *pool, unsigned count)
VLC_USED;
#endif /* VLC_PICTURE_POOL_H */

View File

@ -335,7 +335,6 @@ picture_pool_Release
picture_pool_Get
picture_pool_New
picture_pool_NewFromFormat
picture_pool_Reserve
picture_pool_Wait
picture_Reset
picture_Setup

View File

@ -153,34 +153,6 @@ error:
return NULL;
}
picture_pool_t *picture_pool_Reserve(picture_pool_t *master, unsigned count)
{
if (count == 0)
vlc_assert_unreachable();
if (unlikely(count > POOL_MAX))
return NULL;
picture_t *picture[POOL_MAX];
unsigned i;
for (i = 0; i < count; i++) {
picture[i] = picture_pool_Get(master);
if (picture[i] == NULL)
goto error;
}
picture_pool_t *pool = picture_pool_New(count, picture);
if (!pool)
goto error;
return pool;
error:
while (i > 0)
picture_Release(picture[--i]);
return NULL;
}
picture_t *picture_pool_Get(picture_pool_t *pool)
{

View File

@ -35,7 +35,7 @@
const char vlc_module_name[] = "test_picture_pool";
static video_format_t fmt;
static picture_pool_t *pool, *reserve;
static picture_pool_t *pool;
static void test(bool zombie)
{
@ -52,9 +52,6 @@ static void test(bool zombie)
for (unsigned i = 0; i < PICTURES; i++)
assert(picture_pool_Get(pool) == NULL);
// Reserve currently assumes that all pictures are free (or reserved).
//assert(picture_pool_Reserve(pool, 1) == NULL);
for (unsigned i = 0; i < PICTURES / 2; i++)
picture_Hold(pics[i]);
@ -79,28 +76,10 @@ static void test(bool zombie)
assert(pics[i] != NULL);
}
for (unsigned i = 0; i < PICTURES; i++)
picture_Release(pics[i]);
reserve = picture_pool_Reserve(pool, PICTURES / 2);
assert(reserve != NULL);
for (unsigned i = 0; i < PICTURES / 2; i++) {
pics[i] = picture_pool_Get(pool);
assert(pics[i] != NULL);
}
for (unsigned i = PICTURES / 2; i < PICTURES; i++) {
assert(picture_pool_Get(pool) == NULL);
pics[i] = picture_pool_Get(reserve);
assert(pics[i] != NULL);
}
if (!zombie)
for (unsigned i = 0; i < PICTURES; i++)
picture_Release(pics[i]);
picture_pool_Release(reserve);
picture_pool_Release(pool);
if (zombie)
@ -115,10 +94,6 @@ int main(void)
pool = picture_pool_NewFromFormat(&fmt, PICTURES);
assert(pool != NULL);
reserve = picture_pool_Reserve(pool, PICTURES / 2);
assert(reserve != NULL);
picture_pool_Release(reserve);
picture_pool_Release(pool);
test(false);