The decryption code (AesDecryptor, soon moved to DecryptCencBuffer and DecryptCbcsBuffer) creates a new DecoderBuffer based on the size of the buffer to be decrypted and then copies "all" the additional fields (e.g. timestamp, is_key_frame, etc.) to the new buffer. It would be better if the copying of the additional fields was done in DecoderBuffer.
Possible approaches:
1) Add a method like CloneFields(const DecoderBuffer& source);
2) Add a static method Clone(). However, this should copy the existing data as well as everything else, which may not be desired [1].
3) Add a new static method like CreateAndCopyAdditionalFields(const DecoderBuffer& source);
There are probably better names.
[1] With encrypted data (in particular pattern decryption), the number of clear bytes in the buffer may be significant (e.g. using a pattern 1:9 90% of the buffer is unencrypted). So copying the source over in one pass and then simply writing over the encrypted portions with the decrypted data may be more efficient. However, if the buffer is all encrypted, this would mean most bytes would be written twice. Need to benchmark this to see if there is a noticeable difference.