Skip to content

Commit 0da812c

Browse files
zhiyua-gitpalpatim
authored andcommitted
Fix the timestamp unit for media codec encoder (#1091)
* Remove trailing zeros before putting frame into SDK * Add unit test for removing trailing zeros * Update KinesisVideoFrameTest.java * Fix validation exception caused by request model update * Add comment and update change log * Fix the timestamp unit for media codec encoder The presentation timestamp in microseconds for this buffer. This is normally the media time at which this buffer should be presented (rendered). according to https://developer.android.com/reference/android/media/MediaCodec.html#queueInputBuffer(int,%20int,%20int,%20long,%20int) * Add change log for time unit bug fix
1 parent a9ba9ee commit 0da812c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# Change Log - AWS SDK for Android
22

3-
### Bug Fixes
4-
* **Amazon Kinesis Video**
5-
* Fixed a bug when CreateStreamRequest is initialized without setting Tags, auto-generated empty HashMap of Tags would cause ValidationException from Kinesis Video.
6-
73
## [Release 2.14.1](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.14.1)
84

95
### Bug Fixes
10-
116
- **AWS Core Runtime**
127
- Fixed response unmarshalling when response is gzip encoded without a CRC32 checksum. Also fixes bug decoding Kinesis responses with GZIP encoding.
8+
- **Amazon Kinesis Video**
9+
- Fixed a bug when CreateStreamRequest is initialized without setting Tags, auto-generated empty HashMap of Tags would cause ValidationException from Kinesis Video.
10+
- Fixed incorrect timestamp unit for encoder input caused high bitrate issue for the stream.
1311

1412
### Misc. Updates
1513

1614
- Model updates for the following services
1715
- Amazon Comprehend
16+
- Amazon Security Token Service (STS)
1817

1918
## [Release 2.14.0](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.14.0)
2019

@@ -1676,4 +1675,3 @@ All documentation is now centralized at https://aws-amplify.github.io/
16761675
### Bug Fixes
16771676
- **Amazon S3**: Fixed an issue that occurs when required headers are not properly signed. This issue affects S3 in two regions: Frankfurt (eu-central-1) and China (cn-north-1). [#42](https://github.com/aws/aws-sdk-android/issues/42)
16781677
- **AWS Core Runtime Library**: Fixed an issue in Maven distribution where an incorrect version string is set in "User-Agent".
1679-
1

aws-android-sdk-kinesisvideo/src/main/java/com/amazonaws/mobileconnectors/kinesisvideo/encoding/EncoderFrameSubmitter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
* - mic drop
8484
*/
8585
public class EncoderFrameSubmitter {
86-
86+
private static final long NS_IN_US = 1000;
8787
private static final long NS_IN_MS = 1000000;
8888
private static final int FROM_START = 0;
8989
private static final int NO_FLAGS = 0;
@@ -101,14 +101,14 @@ public void submitFrameToEncoder(final Image frameImageYUV420,
101101

102102
// encoders are super sensitive to the timestamps, careful here
103103
final long timestamp = nanosSinceFirstFrame();
104-
queueIntoInputImage(frameImageYUV420, timestamp, endOfStream);
104+
queueIntoInputImage(frameImageYUV420, timestamp / NS_IN_US, endOfStream);
105105
}
106106

107107
/**
108108
* TLDR: read the above javadoc for the class
109109
*/
110110
private void queueIntoInputImage(final Image frameImageYUV420,
111-
final long timestamp,
111+
final long timestampInUS,
112112
final boolean endOfStream) {
113113

114114
final int flags = endOfStream ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : NO_FLAGS;
@@ -126,7 +126,7 @@ private void queueIntoInputImage(final Image frameImageYUV420,
126126
inputBufferIndex,
127127
FROM_START,
128128
tmpBufferSize,
129-
timestamp,
129+
timestampInUS,
130130
flags);
131131
}
132132

0 commit comments

Comments
 (0)