Split reference frame invalidation support capabilities into codec-specific options

This commit is contained in:
Cameron Gutman 2017-05-15 23:11:37 -07:00
parent 7aeaefd24f
commit ec6c569130
3 changed files with 15 additions and 5 deletions

View File

@ -203,7 +203,8 @@ int getNextFrameInvalidationTuple(PQUEUED_FRAME_INVALIDATION_TUPLE* qfit) {
} }
void queueFrameInvalidationTuple(int startFrame, int endFrame) { void queueFrameInvalidationTuple(int startFrame, int endFrame) {
if (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION) { if ((NegotiatedVideoFormat == VIDEO_FORMAT_H264 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
((NegotiatedVideoFormat == VIDEO_FORMAT_H265 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC)))) {
PQUEUED_FRAME_INVALIDATION_TUPLE qfit; PQUEUED_FRAME_INVALIDATION_TUPLE qfit;
qfit = malloc(sizeof(*qfit)); qfit = malloc(sizeof(*qfit));
if (qfit != NULL) { if (qfit != NULL) {

View File

@ -86,10 +86,15 @@ typedef struct _DECODE_UNIT {
// renderer is non-blocking. This flag is valid on both audio and video renderers. // renderer is non-blocking. This flag is valid on both audio and video renderers.
#define CAPABILITY_DIRECT_SUBMIT 0x1 #define CAPABILITY_DIRECT_SUBMIT 0x1
// !!! HIGHLY EXPERIMENTAL - DO NOT SET IN PRODUCTION CODE !!!
// If set in the video renderer capabilities field, this flag specifies that the renderer // If set in the video renderer capabilities field, this flag specifies that the renderer
// supports reference frame invalidation. This flag is only valid on video renderers. // supports reference frame invalidation for AVC/H.264 streams. This flag is only valid on video renderers.
#define CAPABILITY_REFERENCE_FRAME_INVALIDATION 0x2 // If using this feature, the bitstream may not be patched (changing num_ref_frames or max_dec_frame_buffering)
// to avoid video corruption on packet loss.
#define CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC 0x2
// If set in the video renderer capabilities field, this flag specifies that the renderer
// supports reference frame invalidation for HEVC/H.265 streams. This flag is only valid on video renderers.
#define CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC 0x4
// If set in the video renderer capabilities field, this macro specifies that the renderer // If set in the video renderer capabilities field, this macro specifies that the renderer
// supports slicing to increase decoding performance. The parameter specifies the desired // supports slicing to increase decoding performance. The parameter specifies the desired

View File

@ -43,7 +43,11 @@ void initializeVideoDepacketizer(int pktSize) {
gotNextFrameStart = 0; gotNextFrameStart = 0;
lastPacketInStream = -1; lastPacketInStream = -1;
decodingFrame = 0; decodingFrame = 0;
strictIdrFrameWait = !(VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION);
LC_ASSERT(NegotiatedVideoFormat != 0);
strictIdrFrameWait =
!((NegotiatedVideoFormat == VIDEO_FORMAT_H264 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
((NegotiatedVideoFormat == VIDEO_FORMAT_H265 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC))));
} }
// Free the NAL chain // Free the NAL chain