//check for decoder configuration to send
IoBuffer config = videoCodec.getDecoderConfiguration();
if (config != null) {
log.debug("Decoder configuration is available for {}", videoCodec.getName());
//log.debug("Dump:\n{}", Hex.encodeHex(config.array()));
VideoData conf = new VideoData(config.asReadOnlyBuffer());
log.trace("Configuration ts: {}", conf.getTimestamp());
RTMPMessage confMsg = RTMPMessage.build(conf);
try {
log.debug("Pushing decoder configuration");
msgOut.pushMessage(confMsg);
} finally {
conf.release();
}
}
//check for a keyframe to send
IoBuffer keyFrame = videoCodec.getKeyframe();
if (keyFrame != null) {
log.debug("Keyframe is available");
VideoData video = new VideoData(keyFrame.asReadOnlyBuffer());
log.trace("Keyframe ts: {}", video.getTimestamp());
//log.debug("Dump:\n{}", Hex.encodeHex(keyFrame.array()));
RTMPMessage videoMsg = RTMPMessage.build(video);
try {
log.debug("Pushing keyframe");
msgOut.pushMessage(videoMsg);
} finally {
video.release();
}
}
} else {
log.debug("Could not initialize stream output, videoCodec is null");
}