I’m building a remote desktop streaming application. One feature that will be critically helpful is to not send any frames if the remote desktop is idle. The idea I had to solve this was to look at each encoded h.264 frame, decide if there are changes (not yet solved), and if there are no changes, then “undo” the encoder, and not send the frame to the client. The purpose of this “undo” operation is that I don’t want future frames referencing this frame, because it’s not going to be sent to the client.
To implement this “undo” operation, I used invalidateReferenceFrames (I think this may not exist on newer SDKs). Here’s a screenshot of docs talking about this: https://www.dropbox.com/s/5n6lgkvoo5it4qq/Screenshot%202020-04-03%2013.15.03.png?dl=0
However, it seems to not work for my use case. Even if a frame is invalidated, it still counts towards the “maxNumRefFrames”. So, say I were to make 10 frames, where the last 9 are invalidated. My 11th frame won’t be able to reference the first frame if maxNumRefFrames is less than 10.
I drew out a picture to describe this situation in another form: https://www.dropbox.com/s/81l4ehtmuu3z6nz/Screenshot%202020-04-03%2013.06.14.png?dl=0
Is this an issue with invalidateReferenceFrames, or am I using the API incorrectly?