code: protected boolean isFragmentReady(StreamingTrack streamingTrack, StreamingSample next) {
          long ts = nextSampleStartTime.get(streamingTrack);
          long cfst = nextFragmentCreateStartTime.get(streamingTrack);
  
          if ((ts > cfst + 3 * streamingTrack.getTimescale())) {
              // mininum fragment length == 3 seconds
              SampleFlagsSampleExtension sfExt = next.getSampleExtension(SampleFlagsSampleExtension.class);
              if (sfExt == null || sfExt.isSyncSample()) {
                  //System.err.println(streamingTrack + " ready at " + ts);
                  // the next sample needs to be a sync sample
                  // when there is no SampleFlagsSampleExtension we assume syncSample == true
                  return true;
              }
          }
          return false;
      }
docs: Tests if the currently received samples for a given track
  form a valid fragment taking the latest received sample into
  account. The next sample is not part of the segment and
  will be added to the fragment buffer later.
  
  @param streamingTrack track to test
  @param next           the lastest samples
  @return true if a fragment has been created.