MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_buffer_realloc

Function hb_buffer_realloc

libhb/fifo.c:460–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460void hb_buffer_realloc( hb_buffer_t * b, int size )
461{
462 if ( size > b->alloc || b->data == NULL )
463 {
464 uint8_t * tmp;
465 uint32_t orig = b->data != NULL ? b->alloc : 0;
466 hb_fifo_t * buffer_pool = size_to_pool(size);
467
468 if (buffer_pool != NULL)
469 {
470 size = buffer_pool->buffer_size;
471 }
472 tmp = av_malloc(size);
473 if (tmp == NULL)
474 {
475 return;
476 }
477 if (b->data != NULL)
478 {
479 memcpy(tmp, b->data, b->alloc);
480 av_free(b->data);
481 }
482 b->data = tmp;
483 b->alloc = size;
484
485 hb_lock(buffers.lock);
486 buffers.allocated += size - orig;
487 hb_unlock(buffers.lock);
488 }
489}
490
491void hb_buffer_reduce( hb_buffer_t * b, int size )
492{

Callers 4

hb_ps_read_packetFunction · 0.85
do_probeFunction · 0.85
hb_ts_stream_append_pktFunction · 0.85
hb_video_buffer_reallocFunction · 0.85

Calls 3

size_to_poolFunction · 0.85
hb_lockFunction · 0.85
hb_unlockFunction · 0.85

Tested by

no test coverage detected