question: private void adjustSizeOfMoovHeader ( Mp4BoxHeader moovHeader , ByteBuffer moovBuffer , int sizeAdjustment , Mp4BoxHeader udtaHeader , Mp4BoxHeader metaHeader ) throws IOException { moovHeader . setLength ( moovHeader . getLength ( ) + sizeAdjustment ) ; if ( udtaHeader != null ) { udtaHeader . setLength ( udtaHeader . getLength ( ) + sizeAdjustment ) ; moovBuffer . position ( ( int ) ( udtaHeader . getFilePos ( ) - moovHeader . getFilePos ( ) - Mp4BoxHeader . HEADER_LENGTH ) ) ; moovBuffer . put ( udtaHeader . getHeaderData ( ) ) ; } if ( metaHeader != null ) { metaHeader . setLength ( metaHeader . getLength ( ) + sizeAdjustment ) ; moovBuffer . position ( ( int ) ( metaHeader . getFilePos ( ) - moovHeader . getFilePos ( ) - Mp4BoxHeader . HEADER_LENGTH ) ) ; moovBuffer . put ( metaHeader . getHeaderData ( ) ) ; } }
target:  When the size of the metadata has changed and it cant be compensated for by free atom we have to adjust the size of the size field upto the moovheader level for the udta atom and its child meta atom.