Group calls: Make renderVideoFrame generate less garbage
This commit is contained in:
parent
fed84be0b6
commit
683823a114
6 changed files with 30 additions and 21 deletions
|
@ -12,12 +12,12 @@ import { FRAME_BUFFER_SIZE } from './constants';
|
|||
* of allocating one per participant. Be careful when using this buffer elsewhere, as it
|
||||
* is not cleaned up and may hold stale data.
|
||||
*/
|
||||
export function useGetCallingFrameBuffer(): () => ArrayBuffer {
|
||||
const ref = useRef<ArrayBuffer | null>(null);
|
||||
export function useGetCallingFrameBuffer(): () => Buffer {
|
||||
const ref = useRef<Buffer | null>(null);
|
||||
|
||||
return useCallback(() => {
|
||||
if (!ref.current) {
|
||||
ref.current = new ArrayBuffer(FRAME_BUFFER_SIZE);
|
||||
ref.current = Buffer.alloc(FRAME_BUFFER_SIZE);
|
||||
}
|
||||
return ref.current;
|
||||
}, []);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue