---
title: "VTCompressionSessionGetPixelBufferPool(_:)"
framework: videotoolbox
role: symbol
role_heading: Function
path: "videotoolbox/vtcompressionsessiongetpixelbufferpool(_:)"
---

# VTCompressionSessionGetPixelBufferPool(_:)

Returns a pool that provides ideal source pixel buffers for a compression session.

## Declaration

```swift
func VTCompressionSessionGetPixelBufferPool(_ session: VTCompressionSession) -> CVPixelBufferPool?
```

## Parameters

- `session`: The compression session.

## Return Value

Return Value A configured pixel buffer pool.

## Discussion

Discussion The compression session creates this pixel buffer pool based on the compressor’s pixel buffer attributes and any pixel buffer attributes passed in to VTCompressionSessionCreate(allocator:width:height:codecType:encoderSpecification:imageBufferAttributes:compressedDataAllocator:outputCallback:refcon:compressionSessionOut:).  If the source pixel buffer attributes and the compressor pixel buffer attributes cannot be reconciled, the pool is based on the source pixel buffer attributes, and VideoToolbox converts each CVImageBuffer internally. note: Clients can call this function once and retain the resulting pool, but the call is cheap enough that it’s ok to call it once per frame.  If a change of session properties causes the compressor’s pixel buffer attributes to change, it’s possible that this function might return a different pool.

## See Also

### Encoding Frames

- [VTCompressionSessionPrepareToEncodeFrames(_:)](videotoolbox/vtcompressionsessionpreparetoencodeframes(_:).md)
- [VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)](videotoolbox/vtcompressionsessionencodeframe(_:imagebuffer:presentationtimestamp:duration:frameproperties:sourceframerefcon:infoflagsout:).md)
- [VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:infoFlagsOut:outputHandler:)](videotoolbox/vtcompressionsessionencodeframe(_:imagebuffer:presentationtimestamp:duration:frameproperties:infoflagsout:outputhandler:).md)
- [VTCompressionSessionCompleteFrames(_:untilPresentationTimeStamp:)](videotoolbox/vtcompressionsessioncompleteframes(_:untilpresentationtimestamp:).md)
