Search in sources :

Example 1 with StreamInfo

use of com.amazonaws.kinesisvideo.producer.StreamInfo in project amazon-kinesis-video-streams-parser-library by aws.

the class ProducerStreamUtil method getCameraStreamInfo.

private static StreamInfo getCameraStreamInfo(final String streamName, final MediaSourceConfiguration mediaSourceConfiguration) throws KinesisVideoException {
    final CameraMediaSourceConfiguration configuration = (CameraMediaSourceConfiguration) mediaSourceConfiguration;
    // Need to fix-up the content type as the Console playback only accepts video/h264 and will fail
    // if the mime type is video/avc which is the default in Android.
    String contentType = configuration.getEncoderMimeType();
    if (contentType.equals("video/avc")) {
        contentType = "video/h264";
    }
    return new StreamInfo(VERSION_ZERO, streamName, StreamInfo.StreamingType.STREAMING_TYPE_REALTIME, contentType, NO_KMS_KEY_ID, configuration.getRetentionPeriodInHours() * HUNDREDS_OF_NANOS_IN_AN_HOUR, NOT_ADAPTIVE, MAX_LATENCY_ZERO, DEFAULT_GOP_DURATION * HUNDREDS_OF_NANOS_IN_A_MILLISECOND, KEYFRAME_FRAGMENTATION, USE_FRAME_TIMECODES, configuration.getIsAbsoluteTimecode(), REQUEST_FRAGMENT_ACKS, RECOVER_ON_FAILURE, StreamInfo.codecIdFromContentType(configuration.getEncoderMimeType()), StreamInfo.createTrackName(configuration.getEncoderMimeType()), configuration.getBitRate(), configuration.getFrameRate(), DEFAULT_BUFFER_DURATION_IN_SECONDS * HUNDREDS_OF_NANOS_IN_A_SECOND, DEFAULT_REPLAY_DURATION_IN_SECONDS * HUNDREDS_OF_NANOS_IN_A_SECOND, DEFAULT_STALENESS_DURATION_IN_SECONDS * HUNDREDS_OF_NANOS_IN_A_SECOND, configuration.getTimeScale() / NANOS_IN_A_TIME_UNIT, RECALCULATE_METRICS, configuration.getCodecPrivateData(), getTags(), configuration.getNalAdaptationFlags());
}
Also used : CameraMediaSourceConfiguration(com.amazonaws.kinesisvideo.client.mediasource.CameraMediaSourceConfiguration) StreamInfo(com.amazonaws.kinesisvideo.producer.StreamInfo)

Aggregations

CameraMediaSourceConfiguration (com.amazonaws.kinesisvideo.client.mediasource.CameraMediaSourceConfiguration)1 StreamInfo (com.amazonaws.kinesisvideo.producer.StreamInfo)1