The addons that use this code already log if there are more than MAX_STREAMS. I think it could be a good idea to log here only, if so then the clients wouldn't have to check for MAX_STREAMS. It would also fix a hypothetical case where the video stream index is over MAX_STREAMS which would mean it doesn't make it into the newStreams vector. Once there the vector is sorted before the bounds check happens so there wouldn't be a problem. What do you think?