code: private final void write(QueuedMediaData queued) {
          // get data type
          byte dataType = queued.getDataType();
          // get timestamp
          int timestamp = queued.getTimestamp();
          log.debug("Write - timestamp: {} type: {}", timestamp, dataType);
          // get queued
          ITag tag = queued.getData();
          if (tag != null) {
              // only allow blank tags if they are of audio type
              if (tag.getBodySize() > 0 || dataType == ITag.TYPE_AUDIO) {
                  // if the last message was a reset or we just started, use the header timer
                  if (startTimestamp == -1) {
                      startTimestamp = timestamp;
                      timestamp = 0;
                  } else {
                      timestamp -= startTimestamp;
                  }
                  // update the timestamp
                  tag.setTimestamp(timestamp);
                  try {
                      if (timestamp >= 0) {
                          if (!writer.writeTag(tag)) {
                              log.warn("Tag was not written");
                          }
                      } else {
                          log.warn("Skipping message with negative timestamp.");
                      }
                  } catch (ClosedChannelException cce) {
                      // the channel we tried to write to is closed, we should not try
                      // again on that writer
                      log.error("The writer is no longer able to write to the file: {} writable: {}", path.getFileName(), path.toFile().canWrite());
                  } catch (IOException e) {
                      log.warn("Error writing tag", e);
                      if (e.getCause() instanceof ClosedChannelException) {
                          // the channel we tried to write to is closed, we should not
                          // try again on that writer
                          log.error("The writer is no longer able to write to the file: {} writable: {}", path.getFileName(), path.toFile().canWrite());
                      }
                  } finally {
                      queued.dispose();
                  }
              }
          }
      }
docs: Adjust timestamp and write to the file.
  
  @param queued
  queued data for write