Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 2.57 KB

videomediaframe.md

File metadata and controls

28 lines (18 loc) · 2.57 KB
-api-id -api-type
T:Windows.Media.Capture.Frames.VideoMediaFrame
winrt class

Windows.Media.Capture.Frames.VideoMediaFrame

-description

Represents a frame from a MediaFrameSource that provides data in a video frame represented by a IDirect3DSurface or SoftwareBitmap.

-remarks

Get an instance of this class by accessing the VideoMediaFrame property of a MediaFrameReference object that was obtained from a media frame source.

Important

If you access the SoftwareBitmap or Direct3DSurface objects provided by the VideoMediaFrame property of a MediaFrameReference, the system creates a strong reference to these objects, which means that they will not be disposed when you call Dispose on the containing MediaFrameReference. You must explicitly call the Dispose method of the SoftwareBitmap or Direct3DSurface directly for the objects to be immediately disposed. Otherwise, the garbage collector will eventually free the memory for these objects, but you can't know when this will occur, and if the number of allocated bitmaps or surfaces exceeds the maximum amount allowed by the system, the flow of new frames will stop. In that same line of thought, if you have called (GetVideoFrame())[videomediaframe_getvideoframe_824740069.md], then the (VideoFrame)[../windows.media/videoframe.md] retrieved has a reference on the SoftwareBitmap or Direct3DSurface objects provided by the VideoMediaFrame and needs to be disposed of by calling manually its Dispose method to avoid blocking the fow of frames. If you intend to hold on to a VideoFrame retrieved via (GetVideoFrame())[videomediaframe_getvideoframe_824740069.md] for an extended period of time, it may be better to hold on to a copy of it instead.

For how-to guidance on using MediaFrameSource to capture frames, see Process media frames with MediaFrameReader.

-examples

-see-also

Process media frames with MediaFrameReader