Skip to content

Commit

Permalink
Bug fix for credentials not rotating issue when given credentials exp…
Browse files Browse the repository at this point in the history
…ire in less than 40 minutes.

Add audio video sample to support ingesting multiple track data into Kinesis Video.
  • Loading branch information
chehefen committed Feb 20, 2019
1 parent a33af12 commit b08c91e
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 29 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ This should resolve native library loading issues.

## Release Notes

### Release 1.9.1 (19 Feburary 2019)
* Bug fix for credentials not rotating issue when given credentials expire in less than 40 minutes.
* Add audio video sample to support injesting multiple track data into Kinesis Video.

### Release 1.9.0 (08 Feburary 2019)
* Bug fix for KinesisVideoClient.unregisterMediaSource() accessing to freed native object issue.
* Add KinesisVideoClient.freeMediaSource() clean-up function to handle async behavior.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.amazonaws.kinesisvideo.demoapp;

import com.amazonaws.kinesisvideo.client.KinesisVideoClient;
import com.amazonaws.kinesisvideo.demoapp.contants.DemoTrackInfos;
import com.amazonaws.kinesisvideo.internal.client.mediasource.MediaSource;
import com.amazonaws.kinesisvideo.common.exception.KinesisVideoException;
import com.amazonaws.kinesisvideo.demoapp.auth.AuthHelper;
Expand Down Expand Up @@ -90,6 +91,7 @@ private static MediaSource createFileMediaSource() {
.withDir(FRAME_DIR)
.withRetentionPeriodInHours(RETENTION_ONE_HOUR)
.withAbsoluteTimecode(ABSOLUTE_TIMECODES)
.withTrackInfoList(DemoTrackInfos.createTrackInfoList())
.build();
final AudioVideoFileMediaSource mediaSource = new AudioVideoFileMediaSource(STREAM_NAME);
mediaSource.configure(configuration);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.amazonaws.kinesisvideo.demoapp.contants;

import com.amazonaws.kinesisvideo.producer.TrackInfo;

import static com.amazonaws.kinesisvideo.producer.MkvTrackInfoType.AUDIO;
import static com.amazonaws.kinesisvideo.producer.MkvTrackInfoType.VIDEO;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.AUDIO_CODEC_ID;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.AUDIO_TRACK_ID;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.VIDEO_CODEC_ID;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.VIDEO_TRACK_ID;

public final class DemoTrackInfos {
private DemoTrackInfos() {
}

// Codec private data could be extracted using gstreamer plugin
// CHECKSTYLE:SUPPRESS:LineLength
// GST_DEBUG=4 gst-launch-1.0 rtspsrc location="YourRtspUrl" short-header=TRUE protocols=tcp ! rtph264depay ! decodebin ! videorate ! videoscale ! vtenc_h264_hw allow-frame-reordering=FALSE max-keyframe-interval=25 bitrate=1024 realtime=TRUE ! video/x-h264,stream-format=avc,alignment=au,profile=baseline,width=640,height=480,framerate=1/25 ! multifilesink location=./frame%03d.h264 index=1 | grep codec_data
private static final byte[] AVCC_EXTRA_DATA = {(byte) 0x01, (byte) 0x42, (byte) 0xc0, (byte) 0x28, (byte) 0xff,
(byte) 0xe1, (byte) 0x00, (byte) 0x1a, (byte) 0x67, (byte) 0x42, (byte) 0xc0, (byte) 0x28, (byte) 0xdb,
(byte) 0x02, (byte) 0x80, (byte) 0xf6, (byte) 0xc0, (byte) 0x5a, (byte) 0x80, (byte) 0x80, (byte) 0x80,
(byte) 0xa0, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x57,
(byte) 0xe4, (byte) 0x01, (byte) 0xe3, (byte) 0x06, (byte) 0x5c, (byte) 0x01, (byte) 0x00, (byte) 0x04,
(byte) 0x68, (byte) 0xca, (byte) 0x8c, (byte) 0xb2};
private static final byte[] AAC_EXTRA_DATA = {(byte) 0x11, (byte) 0x90};

public static TrackInfo[] createTrackInfoList() {
return new TrackInfo[] {
new TrackInfo(VIDEO_TRACK_ID, VIDEO_CODEC_ID, "VideoTrack", AVCC_EXTRA_DATA, VIDEO),
new TrackInfo(AUDIO_TRACK_ID, AUDIO_CODEC_ID, "AudioTrack", AAC_EXTRA_DATA, AUDIO)
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,10 @@


import com.amazonaws.kinesisvideo.internal.mediasource.multitrack.MultiTrackMediaSourceConfiguration;
import com.amazonaws.kinesisvideo.producer.TrackInfo;

import static com.amazonaws.kinesisvideo.producer.MkvTrackInfoType.AUDIO;
import static com.amazonaws.kinesisvideo.producer.MkvTrackInfoType.VIDEO;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.AUDIO_TRACK_ID;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.AUDIO_VIDEO_CONTENT_TYPE;
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.VIDEO_TRACK_ID;

public class AudioVideoFileMediaSourceConfiguration extends MultiTrackMediaSourceConfiguration {
// Codec private data could be extracted using gstreamer plugin
// CHECKSTYLE:SUPPRESS:LineLength
// GST_DEBUG=4 gst-launch-1.0 rtspsrc location="YourRtspUrl" short-header=TRUE protocols=tcp ! rtph264depay ! decodebin ! videorate ! videoscale ! vtenc_h264_hw allow-frame-reordering=FALSE max-keyframe-interval=25 bitrate=1024 realtime=TRUE ! video/x-h264,stream-format=avc,alignment=au,profile=baseline,width=640,height=480,framerate=1/25 ! multifilesink location=./frame%03d.h264 index=1 | grep codec_data
private static final byte[] AVCC_EXTRA_DATA = {(byte) 0x01, (byte) 0x42, (byte) 0xc0, (byte) 0x28, (byte) 0xff,
(byte) 0xe1, (byte) 0x00, (byte) 0x1a, (byte) 0x67, (byte) 0x42, (byte) 0xc0, (byte) 0x28, (byte) 0xdb,
(byte) 0x02, (byte) 0x80, (byte) 0xf6, (byte) 0xc0, (byte) 0x5a, (byte) 0x80, (byte) 0x80, (byte) 0x80,
(byte) 0xa0, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x57,
(byte) 0xe4, (byte) 0x01, (byte) 0xe3, (byte) 0x06, (byte) 0x5c, (byte) 0x01, (byte) 0x00, (byte) 0x04,
(byte) 0x68, (byte) 0xca, (byte) 0x8c, (byte) 0xb2};
private static final byte[] AAC_EXTRA_DATA = {(byte) 0x11, (byte) 0x90};


private final Builder builder;

Expand All @@ -29,13 +14,6 @@ protected AudioVideoFileMediaSourceConfiguration(final Builder builder) {
this.builder = builder;
}

private static TrackInfo[] createTrackInfoList() {
return new TrackInfo[] {
new TrackInfo(VIDEO_TRACK_ID, "video/h264", "VideoTrack", AVCC_EXTRA_DATA, VIDEO),
new TrackInfo(AUDIO_TRACK_ID, "audio/aac", "AudioTrack", AAC_EXTRA_DATA, AUDIO)
};
}

public String getDir() {
return builder.dir;
}
Expand All @@ -61,9 +39,6 @@ public T withDir(final String dir) {

@Override
public AudioVideoFileMediaSourceConfiguration build() {
if (trackInfoList == null) {
withTrackInfoList(createTrackInfoList());
}
if (contentType == null) {
withContentType(AUDIO_VIDEO_CONTENT_TYPE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ public final class StreamInfoConstants {
public static final boolean ABSOLUTE_TIMECODES = true;
public static final boolean RELATIVE_TIMECODES = false;
public static final boolean RECALCULATE_METRICS = true;
public static final int DEFAULT_TRACK_ID = 0;
public static final int DEFAULT_TRACK_ID = 1;
public static final int VIDEO_TRACK_ID = DEFAULT_TRACK_ID;
public static final int AUDIO_TRACK_ID = 1;
public static final int AUDIO_TRACK_ID = DEFAULT_TRACK_ID + 1;
public static final String VIDEO_CONTENT_TYPE = "video/h264";
public static final String AUDIO_VIDEO_CONTENT_TYPE = "video/h264,audio/aac";
public static final long FRAME_DURATION_0_MS = 0L;
public static final String VIDEO_CODEC_ID = "V_MPEG4/ISO/AVC";
public static final String AUDIO_CODEC_ID = "A_AAC";

/**
* Default buffer duration for a stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public final class VersionUtil {

public static final String AWS_SDK_KVS_PRODUCER_VERSION_STRING = "1.7.0";
public static final String AWS_SDK_KVS_PRODUCER_VERSION_STRING = "1.9.1";

private static final String DEFAULT_USER_AGENT_NAME = "AWS-SDK-KVS";

Expand Down
Binary file modified src/main/resources/lib/mac/libKinesisVideoProducerJNI.dylib
Binary file not shown.
Binary file modified src/main/resources/lib/raspian/libKinesisVideoProducerJNI.so
Binary file not shown.
Binary file modified src/main/resources/lib/ubuntu/libKinesisVideoProducerJNI.so
Binary file not shown.
Binary file modified src/main/resources/lib/windows/KinesisVideoProducerJNI.dll
Binary file not shown.

0 comments on commit b08c91e

Please sign in to comment.