private int decodeExtensionPayload(int cnt,ChannelElement che,int elemType){
  boolean crcFlag=false;
  int res=cnt;
switch (br.read(4)) {
case EXT_SBR_DATA_CRC:
    crcFlag=true;
case EXT_SBR_DATA:
  if (che == null) {
    log.error(String.format("SBR was found before the first channel element"));
    return res;
  }
 else   if (ac.oc[1].m4ac.sbr == 0) {
    log.error(String.format("SBR signaled to be not-present but was found in the bitstream"));
    br.skip(8 * cnt - 4);
    return res;
  }
 else   if (ac.oc[1].m4ac.sbr == -1 && ac.oc[1].status == OC_LOCKED) {
    log.error(String.format("Implicit SBR was found with a first occurrence after the first frame"));
    br.skip(8 * cnt - 4);
    return res;
  }
 else   if (ac.oc[1].m4ac.ps == -1 && ac.oc[1].status < OC_LOCKED && ac.channels == 1) {
    ac.oc[1].m4ac.sbr=1;
    ac.oc[1].m4ac.ps=1;
    outputConfigure(ac.oc[1].layoutMap,ac.oc[1].layoutMapTags,ac.oc[1].status,true);
  }
 else {
    ac.oc[1].m4ac.sbr=1;
  }
res=AacSbr.decodeSbrExtension(ac,che.sbr,crcFlag,cnt,elemType);
break;
case EXT_DYNAMIC_RANGE:
res=decodeDynamicRange(ac.cheDrc);
break;
case EXT_FILL:
decodeFill(8 * cnt - 4);
break;
case EXT_FILL_DATA:
case EXT_DATA_ELEMENT:
default :
br.skip(8 * cnt - 4);
break;
}
return res;
}

private int decodeExtensionPayload ( int cnt , ChannelElement che , int elemType ) { boolean crcFlag = false ; int res = cnt ; switch ( br . read ( 4 ) ) { case EXT_SBR_DATA_CRC : crcFlag = true ; case EXT_SBR_DATA : if ( che == null ) { log . error ( String . format ( "SBR was found before the first channel element" ) ) ; return res ; } else if ( ac . oc [ 1 ] . m4ac . sbr == 0 ) { log . error ( String . format ( "SBR signaled to be not-present but was found in the bitstream" ) ) ; br . skip ( 8 * cnt - 4 ) ; return res ; } else if ( ac . oc [ 1 ] . m4ac . sbr == - 1 && ac . oc [ 1 ] . status == OC_LOCKED ) { log . error ( String . format ( "Implicit SBR was found with a first occurrence after the first frame" ) ) ; br . skip ( 8 * cnt - 4 ) ; return res ; } else if ( ac . oc [ 1 ] . m4ac . ps == - 1 && ac . oc [ 1 ] . status < OC_LOCKED && ac . channels == 1 ) { ac . oc [ 1 ] . m4ac . sbr = 1 ; ac . oc [ 1 ] . m4ac . ps = 1 ; outputConfigure ( ac . oc [ 1 ] . layoutMap , ac . oc [ 1 ] . layoutMapTags , ac . oc [ 1 ] . status , true ) ; } else { ac . oc [ 1 ] . m4ac . sbr = 1 ; } res = AacSbr . decodeSbrExtension ( ac , che . sbr , crcFlag , cnt , elemType ) ; break ; case EXT_DYNAMIC_RANGE : res = decodeDynamicRange ( ac . cheDrc ) ; break ; case EXT_FILL : decodeFill ( 8 * cnt - 4 ) ; break ; case EXT_FILL_DATA : case EXT_DATA_ELEMENT : default : br . skip ( 8 * cnt - 4 ) ; break ; } return res ; }
decode extension data ( incomplete ) ; reference : table 4 . 51 .
