private int calculateHeaderSize ( final Header header , final Header lastHeader ) { final byte headerType = getHeaderType ( header , lastHeader ) ; int channelIdAdd = 0 ; int channelId = header . getChannelId ( ) ; if ( channelId > 320 ) { channelIdAdd = 2 ; } else if ( channelId > 63 ) { channelIdAdd = 1 ; } return RTMPUtils . getHeaderLength ( headerType ) + channelIdAdd ; }
Calculate number of bytes necessary to encode the header .