Skip to content

Commit d3ba97b

Browse files
authored
fix producer cpp set correct default for intermittent producer scenar… (#654)
* fix producer cpp set correct default for intermittent producer scenario and docs * better logical ordering of ip scenario * formatting * be more explicit about not tearing down SDK pipeline
1 parent 2c80f14 commit d3ba97b

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

CMake/Dependencies/libkvscproducer-CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(ExternalProject)
77
# clone repo only
88
ExternalProject_Add(libkvscproducer-download
99
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
10-
GIT_TAG d1095356712729d0489e56d1d0e27f5ce0a29fad
10+
GIT_TAG dcde7e188a74daffb62986a7d172128d3c6f4b48
1111
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvscproducer-src"
1212
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvscproducer-build"
1313
CONFIGURE_COMMAND ""

docs/intermittent_producer.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## What is intermittent streaming?
2+
Intermittent streaming is when you want to send and stop video at will without having to teardown and setup the SDK pipeline again. For example consider a doorbell camera which only wants to record motion events. The application might want to start producing frames as soon as it detects motion and then stop at some point when there is no longer motion and then not stream again until it detects motion.
3+
4+
## Intermittent Producer Handling
5+
### Before v3.1.0
6+
The KVS back-end times out after 30s of not receiving any frames. If the SDK received frames after 30+ seconds of no frames then it would error. We introduced a complex way for client applications to be able to make an API call which would signal to the backend that we're done recording and to close out the session. However this does not work in cases where the stream application doesn't know that it's "done" streaming and it also doesn't know in advance whether or not it will need to stream again within the next 30s.
7+
8+
9+
### Since v3.1.0
10+
By default we have automatic handling for intermittent streaming. This means client applications don't need to do anything other than just put frames when they have them and simply do nothing when there are no frames to send, the SDK will take care of making sure the back-end is notified when there are gaps in the stream and even if it's hours between streaming the client application doesn't need to do anything simply continue putting frames as you would normally.
11+
This comes at a cost of using 1 extra thread to manage the timer used by the SDK to automatically signal to the KVS back-end that a fragment can be closed out. If on a prior release of the SDK you were manually setting fields like `stream_info_.streamCaps.frameOrderingMode` you no longer should do that.
12+
13+
If for some reason you would like to opt-out of this functionality (which is enabled by default) then in the method `KinesisVideoProducer::create` right after we create `device_info` you can set the following:
14+
15+
```
16+
device_info.clientInfo.automaticStreamingFlags = AUTOMATIC_STREAMING_ALWAYS_CONTINUOUS
17+
```
18+
19+
20+
21+

src/StreamDefinition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void StreamDefinition::addTrack(const uint64_t track_id,
108108
MKV_TRACK_INFO_TYPE track_type,
109109
const uint8_t* codecPrivateData,
110110
uint32_t codecPrivateDataSize) {
111-
stream_info_.streamCaps.frameOrderingMode = FRAME_ORDERING_MODE_MULTI_TRACK_AV_COMPARE_PTS_ONE_MS_COMPENSATE;
111+
stream_info_.streamCaps.frameOrderingMode = FRAME_ORDERING_MODE_MULTI_TRACK_AV_COMPARE_PTS_ONE_MS_COMPENSATE_EOFR;
112112
track_info_.push_back(StreamTrackInfo{track_id,
113113
track_name,
114114
codec_id,

0 commit comments

Comments
 (0)