question: public void appendToNalUnit ( byte [ ] data , int offset , int limit ) { if ( ! isFilling ) { return ; } int readLength = limit - offset ; if ( buffer . length < bufferLength + readLength ) { buffer = Arrays . copyOf ( buffer , ( bufferLength + readLength ) * 2 ) ; } System . arraycopy ( data , offset , buffer , bufferLength , readLength ) ; bufferLength += readLength ; scratch . reset ( buffer , bufferLength ) ; if ( scratch . bitsLeft ( ) < 8 ) { return ; } scratch . skipBits ( 1 ) ; int nalRefIdc = scratch . readBits ( 2 ) ; scratch . skipBits ( 5 ) ; if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } scratch . readUnsignedExpGolombCodedInt ( ) ; if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } int sliceType = scratch . readUnsignedExpGolombCodedInt ( ) ; if ( ! detectAccessUnits ) { isFilling = false ; sliceHeader . setSliceType ( sliceType ) ; return ; } if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } int picParameterSetId = scratch . readUnsignedExpGolombCodedInt ( ) ; if ( pps . indexOfKey ( picParameterSetId ) < 0 ) { isFilling = false ; return ; } NalUnitUtil . PpsData ppsData = pps . get ( picParameterSetId ) ; NalUnitUtil . SpsData spsData = sps . get ( ppsData . seqParameterSetId ) ; if ( spsData . separateColorPlaneFlag ) { if ( scratch . bitsLeft ( ) < 2 ) { return ; } scratch . skipBits ( 2 ) ; } if ( scratch . bitsLeft ( ) < spsData . frameNumLength ) { return ; } boolean fieldPicFlag = false ; boolean bottomFieldFlagPresent = false ; boolean bottomFieldFlag = false ; int frameNum = scratch . readBits ( spsData . frameNumLength ) ; if ( ! spsData . frameMbsOnlyFlag ) { if ( scratch . bitsLeft ( ) < 1 ) { return ; } fieldPicFlag = scratch . readBit ( ) ; if ( fieldPicFlag ) { if ( scratch . bitsLeft ( ) < 1 ) { return ; } bottomFieldFlag = scratch . readBit ( ) ; bottomFieldFlagPresent = true ; } } boolean idrPicFlag = nalUnitType == NAL_UNIT_TYPE_IDR ; int idrPicId = 0 ; if ( idrPicFlag ) { if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } idrPicId = scratch . readUnsignedExpGolombCodedInt ( ) ; } int picOrderCntLsb = 0 ; int deltaPicOrderCntBottom = 0 ; int deltaPicOrderCnt0 = 0 ; int deltaPicOrderCnt1 = 0 ; if ( spsData . picOrderCountType == 0 ) { if ( scratch . bitsLeft ( ) < spsData . picOrderCntLsbLength ) { return ; } picOrderCntLsb = scratch . readBits ( spsData . picOrderCntLsbLength ) ; if ( ppsData . bottomFieldPicOrderInFramePresentFlag && ! fieldPicFlag ) { if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } deltaPicOrderCntBottom = scratch . readSignedExpGolombCodedInt ( ) ; } } else if ( spsData . picOrderCountType == 1 && ! spsData . deltaPicOrderAlwaysZeroFlag ) { if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } deltaPicOrderCnt0 = scratch . readSignedExpGolombCodedInt ( ) ; if ( ppsData . bottomFieldPicOrderInFramePresentFlag && ! fieldPicFlag ) { if ( ! scratch . canReadExpGolombCodedNum ( ) ) { return ; } deltaPicOrderCnt1 = scratch . readSignedExpGolombCodedInt ( ) ; } } sliceHeader . setAll ( spsData , nalRefIdc , sliceType , frameNum , picParameterSetId , fieldPicFlag , bottomFieldFlagPresent , bottomFieldFlag , idrPicFlag , idrPicId , picOrderCntLsb , deltaPicOrderCntBottom , deltaPicOrderCnt0 , deltaPicOrderCnt1 ) ; isFilling = false ; }
target:  Invoked to pass stream data. The data passed should not include the 3 byte start code.