Skip to content

Commit 4f1d3ad

Browse files
niyatim23disa6302Hongli Wang
authored
Release 1.10.2 (#1981)
* Add H265 and AAC frames (#1962) * aac and h265 frames * update readme * update cmake with h265 and aac * clang formay * [Sample] GStreamer media receiver (#1963) * create the gst receiver * fix ci * cmake flag * clang format, add cmake flag in ci * install gstreamer on ci * use macos12 * use defined values * indent * clang-format * readme and commentsa * clang :( * install glib to fix ci * -DCOMPILER_WARNINGS=FALSE to fix the CI * fix macos version for clang * address comments and cleanup * new viewer with gst * clang-format * missing null check * address comments * -DCOMPILER_WARNINGS=TRUE * clang-format * gst_init_check * fix CI * fix CI * [Bug] GStreamer sample (#1972) * gst-sample-fix * modify the message * fix windows * set to null * fix pts and eos in sample * unused var removed * move null init * Version check job (#1974) * Version check job * Working Version check template * Retest with dev * Version lint * Version lint * use new frames (#1978) * Sample TWCC implementation (#1957) * encoder bitrate change based on twcc * Change to 5% inc and dec * modify percentages * ema based calc * EMa fix * Nits * Readme * flip * memset remove * Readme update, move enable flags to createSampleConfiguration * Add codecov token * [Feature] Add H265 support with SDP, RTP payloader-deplayloader (#1965) * Add RtpH265Payloader.c and RtpH265Payloader.h * Add support for H265 in PeerConnection/SessionDescription * Add support for H265 in PeerConnection/PeerConnection * Add support for H265 in PeerConnection/Rtp * Add support for H265 in samples/Common.c * Add support for H265 in samples/kvsWebRTCClientMaster.c * rtp, sdp fix, flag removed, clang fixed, windows build fixed, new test added * test fix * cleanup * cleanup * remove #if 0 * clang * presentation ts fix * clang-format fix * PKG_CONFIG_PATH in kvscommon * missing bracket * fix all builds * ci * cleanup * fix windows build, rename h265 defs * remove duplicate line from h264 and h265 * sample changes * address comments * clang-format * gst sample * cleanup args * clang-format * cleanup * add sdp tests * address comments * address commentas * set default payload type only once * address comments * fix height and width * sdp change --------- Co-authored-by: Hongli Wang <hongliwo@amazon.com> * Version bump, fix tests, remove enableIceStats * Remove AAC related changes * Remove AAC frames * Clang format * fix kvsWebrtcClientMasterGstSample.c name in CMakeLists --------- Co-authored-by: Divya Sampath Kumar <disa6302@colorado.edu> Co-authored-by: Hongli Wang <hongliwo@amazon.com>
1 parent f107343 commit 4f1d3ad

File tree

1,527 files changed

+1558
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,527 files changed

+1558
-203
lines changed

.github/workflows/ci.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- master
1212
jobs:
1313
clang-format-check:
14-
runs-on: macos-latest
14+
runs-on: macos-12
1515
steps:
1616
- name: Clone repository
1717
uses: actions/checkout@v3
@@ -78,6 +78,7 @@ jobs:
7878
runs-on: macos-13-xlarge
7979
env:
8080
AWS_KVS_LOG_LEVEL: 2
81+
PKG_CONFIG_PATH: /usr/local/opt/pkgconfig
8182
permissions:
8283
id-token: write
8384
contents: read
@@ -89,6 +90,9 @@ jobs:
8990
with:
9091
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
9192
aws-region: ${{ secrets.AWS_REGION }}
93+
- name: Install dependencies
94+
run: |
95+
brew install gstreamer glib
9296
- name: Build repository
9397
run: |
9498
brew unlink openssl
@@ -552,6 +556,7 @@ jobs:
552556
- name: Install dependencies
553557
shell: powershell
554558
run: |
559+
choco install pkgconfiglite
555560
choco install gstreamer --version=1.16.3
556561
choco install gstreamer-devel --version=1.16.3
557562
curl.exe -o C:\tools\pthreads-w32-2-9-1-release.zip ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
@@ -580,7 +585,7 @@ jobs:
580585
shell: powershell
581586
run: |
582587
$env:Path += ';C:\webrtc\open-source\bin;C:\tools\pthreads-w32-2-9-1-release\Pre-built.2\dll\x64;C:\webrtc\build'
583-
& "C:\webrtc\build\tst\webrtc_client_test.exe" --gtest_filter="-SignalingApiFunctionalityTest.receivingIceConfigOffer_SlowClockSkew:SignalingApiFunctionalityTest.iceServerConfigRefreshConnectedAuthExpiration:SignalingApiFunctionalityTest.receivingIceConfigOffer_FastClockSkew:SignalingApiFunctionalityTest.receivingIceConfigOffer_FastClockSkew_VerifyOffsetRemovedWhenClockFixed:DataChannelFunctionalityTest.*:DtlsApiTest.*:IceApiTest.*:IceFunctionalityTest.*:PeerConnectionFunctionalityTest.*:TurnConnectionFunctionalityTest.*:RtpFunctionalityTest.marshallUnmarshallH264Data:RtpFunctionalityTest.packingUnpackingVerifySameH264Frame:RtcpFunctionalityTest.onRtcpPacketCompound:RtcpFunctionalityTest.twcc3"
588+
& "C:\webrtc\build\tst\webrtc_client_test.exe" --gtest_filter="-SignalingApiFunctionalityTest.receivingIceConfigOffer_SlowClockSkew:SignalingApiFunctionalityTest.iceServerConfigRefreshConnectedAuthExpiration:SignalingApiFunctionalityTest.receivingIceConfigOffer_FastClockSkew:SignalingApiFunctionalityTest.receivingIceConfigOffer_FastClockSkew_VerifyOffsetRemovedWhenClockFixed:DataChannelFunctionalityTest.*:DtlsApiTest.*:IceApiTest.*:IceFunctionalityTest.*:PeerConnectionFunctionalityTest.*:TurnConnectionFunctionalityTest.*:RtpFunctionalityTest.marshallUnmarshallH264Data:RtpFunctionalityTest.packingUnpackingVerifySameH264Frame:RtpFunctionalityTest.packingUnpackingVerifySameH265Frame:RtcpFunctionalityTest.onRtcpPacketCompound:RtcpFunctionalityTest.twcc3"
584589
# windows-msvc-mbedtls:
585590
# runs-on: windows-2022
586591
# env:

.github/workflows/codecov.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
runs-on: ubuntu-20.04
1414
env:
1515
AWS_KVS_LOG_LEVEL: 2
16+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1617
permissions:
1718
id-token: write
1819
contents: read

.github/workflows/version-check.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check Version Mismatch between PR branch and master.
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check-version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout PR branch
13+
uses: actions/checkout@v4
14+
15+
- name: Get version from PR
16+
id: pr_version
17+
run: |
18+
PR_VERSION=$(grep -Po 'KinesisVideoWebRTCClient VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
19+
echo "PR_VERSION=$PR_VERSION" >> "$GITHUB_ENV"
20+
echo "PR Version: $PR_VERSION"
21+
22+
- name: Checkout master branch
23+
uses: actions/checkout@v4
24+
with:
25+
ref: master
26+
27+
- name: Get version from master
28+
id: master_version
29+
run: |
30+
MASTER_VERSION=$(grep -Po 'KinesisVideoWebRTCClient VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
31+
echo "MASTER_VERSION=$MASTER_VERSION" >> "$GITHUB_ENV"
32+
echo "Master version: $MASTER_VERSION"
33+
34+
- name: Compare versions
35+
run: |
36+
echo "Comparing PR Version: $PR_VERSION with Master Version: $MASTER_VERSION"
37+
if [ "$MASTER_VERSION" == "$PR_VERSION" ]; then
38+
echo "Please update the version in CMakeLists.txt file (project(KinesisVideoWebRTCClient VERSION <ver-string> LANGUAGES C). Any PR getting merged to master requires a version update"
39+
exit 1
40+
else
41+
echo "Version update detected."
42+
fi

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include(CheckIncludeFiles)
55
include(CheckFunctionExists)
66

77
# The version MUST be updated before every release
8-
project(KinesisVideoWebRTCClient VERSION 1.10.1 LANGUAGES C)
8+
project(KinesisVideoWebRTCClient VERSION 1.10.2 LANGUAGES C)
99

1010
# User Flags
1111
option(ADD_MUCLIBC "Add -muclibc c flag" OFF)
@@ -440,6 +440,7 @@ if (BUILD_SAMPLE)
440440
# copy sample frames to build folder, in case developer runs sample program with command `samples/kvsWebrtcClientMaster` from `build` dir.
441441
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/samples/opusSampleFrames" DESTINATION .)
442442
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/samples/h264SampleFrames" DESTINATION .)
443+
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/samples/h265SampleFrames" DESTINATION .)
443444

444445
add_subdirectory(samples)
445446
endif()

README.md

+108-4
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,18 @@ After executing `make` you will have sample applications in your `build/samples`
268268
#### Sample: kvsWebrtcClientMaster
269269
This application sends sample H264/Opus frames (path: `/samples/h264SampleFrames` and `/samples/opusSampleFrames`) via WebRTC. It also accepts incoming audio, if enabled in the browser. When checked in the browser, it prints the metadata of the received audio packets in your terminal. To run:
270270
```shell
271-
./samples/kvsWebrtcClientMaster <channelName>
271+
./samples/kvsWebrtcClientMaster <channelName> <storage-option> <audio-codec> <video-codec>
272272
```
273273

274274
To use the **Storage for WebRTC** feature, run the same command as above but with an additional command line arg to enable the feature.
275275

276276
```shell
277-
./samples/kvsWebrtcClientMaster <channelName> 1
277+
./samples/kvsWebrtcClientMaster <channelName> 1 <audio-codec> <video-codec>
278278
```
279279

280+
Allowed audio-codec: opus (default codec if nothing is specified)
281+
Allowed video-codec: h264 (default codec if nothing is specified), h265
282+
280283
#### Sample: kvsWebrtcClientMasterGstSample
281284
This application can send media from a GStreamer pipeline using test H264/Opus frames, device `autovideosrc` and `autoaudiosrc` input, or a received RTSP stream. It also will playback incoming audio via an `autoaudiosink`. To run:
282285
```shell
@@ -288,11 +291,59 @@ Pass the desired media and source type when running the sample. The mediaType ca
288291
./samples/kvsWebrtcClientMasterGstSample <channelName> <mediaType> rtspsrc rtsp://<rtspUri>
289292
```
290293

294+
Using the testsrc with audio and video-codec
295+
```shell
296+
./samples/kvsWebrtcClientMasterGstSample <channelName> <mediaType> <sourceType> <audio-codec> <video-codec>
297+
```
298+
299+
Example:
300+
```shell
301+
./samples/kvsWebrtcClientMasterGstSample <channelName> audio-video testsrc opus h264
302+
```
303+
304+
Allowed audio-codec: opus (default codec if nothing is specified)
305+
Allowed video-codec: h264 (default codec if nothing is specified), h265
291306

292307
#### Sample: kvsWebrtcClientViewer
293-
This application accepts sample H264/Opus frames and prints them out. To run:
308+
This application accepts sample H264/Opus frames by default. You can use other supported codecs by changing the value for `videoTrack.codec` and `audioTrack.codec` in _Common.c_. By default, this sample only logs the size of the audio and video buffer it receives. To write these frames to a file using GStreamer, use the _kvsWebrtcClientViewerGstSample_ instead.
309+
310+
To run:
311+
```shell
312+
./samples/kvsWebrtcClientViewer <channelName> <audio-codec> <video-codec>
313+
```
314+
315+
Allowed audio-codec: opus (default codec if nothing is specified)
316+
Allowed video-codec: h264 (default codec if nothing is specified), h265
317+
318+
#### Sample: kvsWebrtcClientViewerGstSample
319+
This application is similar to the kvsWebrtcClientViewer. However, instead of just logging the media it receives, it generates a file using filesink. Make sure that your device has enough space to write the media to a file. You can also customize the receiving logic by modifying the functions in _GstAudioVideoReceiver.c_
320+
321+
To run:
294322
```shell
295-
./samples/kvsWebrtcClientViewer <channelName>
323+
./samples/kvsWebrtcClientViewerGstSample <channelName> <mediaType> <audio-codec> <video-codec>
324+
```
325+
326+
Allowed audio-codec: opus (default codec if nothing is specified)
327+
Allowed video-codec: h264 (default codec if nothing is specified), h265
328+
329+
##### Known issues:
330+
Our GStreamer samples leverage [MatroskaMux](https://gstreamer.freedesktop.org/documentation/matroska/matroskamux.html?gi-language=c) to receive media from its peer and save it to a file. However, MatroskaMux is designed for scenarios where the media's format remains constant throughout streaming. When the media's format changes mid-streaming (referred to as "caps changes"), MatroskaMux encounters limitations, its behavior cannot be predicted and it may be unable to handle these changes, resulting in an error message like:
331+
332+
```shell
333+
matroskamux matroska-mux.c:1134:gst_matroska_mux_video_pad_setcaps:<mux> error: Caps changes are not supported by Matroska
334+
```
335+
To address this issue, users need to adapt the pipeline to utilize components capable of managing dynamic changes in media formats. This might involve integrating different muxers or customizing the pipeline to handle caps changes effectively.
336+
337+
#### Sample: Generating sample frames
338+
339+
##### H264
340+
```shell
341+
gst-launch-1.0 videotestsrc pattern=ball num-buffers=1500 ! timeoverlay ! videoconvert ! video/x-raw,format=I420,width=1280,height=720,framerate=25/1 ! queue ! x264enc bframes=0 speed-preset=veryfast bitrate=512 byte-stream=TRUE tune=zerolatency ! video/x-h264,stream-format=byte-stream,alignment=au,profile=baseline ! multifilesink location="frame-%04d.h264" index=1
342+
```
343+
344+
##### H265
345+
```shell
346+
gst-launch-1.0 videotestsrc pattern=ball num-buffers=1500 ! timeoverlay ! videoconvert ! video/x-raw,format=I420,width=1280,height=720,framerate=25/1 ! queue ! x265enc speed-preset=veryfast bitrate=512 tune=zerolatency ! video/x-h265,stream-format=byte-stream,alignment=au,profile=main ! multifilesink location="frame-%04d.h265" index=1
296347
```
297348

298349
### Viewing Master Samples
@@ -350,6 +401,33 @@ createLwsIotCredentialProvider(
350401
freeIotCredentialProvider(&pSampleConfiguration->pCredentialProvider);
351402
```
352403
404+
## TWCC support
405+
406+
Transport Wide Congestion Control (TWCC) is a mechanism in WebRTC designed to enhance the performance and reliability of real-time communication over the internet. TWCC addresses the challenges of network congestion by providing detailed feedback on the transport of packets across the network, enabling adaptive bitrate control and optimization of media streams in real-time. This feedback mechanism is crucial for maintaining high-quality audio and video communication, as it allows senders to adjust their transmission strategies based on comprehensive information about packet losses, delays, and jitter experienced across the entire transport path.
407+
408+
The importance of TWCC in WebRTC lies in its ability to ensure efficient use of available network bandwidth while minimizing the negative impacts of network congestion. By monitoring the delivery of packets across the network, TWCC helps identify bottlenecks and adjust the media transmission rates accordingly. This dynamic approach to congestion control is essential for preventing degradation in call quality, such as pixelation, stuttering, or drops in audio and video streams, especially in environments with fluctuating network conditions.
409+
410+
To learn more about TWCC, check [TWCC spec](https://datatracker.ietf.org/doc/html/draft-holmer-rmcat-transport-wide-cc-extensions-01)
411+
412+
### Enabling TWCC support
413+
414+
TWCC is enabled by default in the SDK samples (via `pSampleConfiguration->enableTwcc`) flag. In order to disable it, set this flag to `FALSE`.
415+
416+
```c
417+
pSampleConfiguration->enableTwcc = FALSE;
418+
```
419+
420+
If not using the samples directly, 2 things need to be done to set up Twcc:
421+
1. Set the `disableSenderSideBandwidthEstimation` to `FALSE`:
422+
```c
423+
configuration.kvsRtcConfiguration.disableSenderSideBandwidthEstimation = FALSE;
424+
```
425+
2. Set the callback that will have the business logic to modify the bitrate based on packet loss information. The callback can be set using `peerConnectionOnSenderBandwidthEstimation()`:
426+
```c
427+
CHK_STATUS(peerConnectionOnSenderBandwidthEstimation(pSampleStreamingSession->pPeerConnection, (UINT64) pSampleStreamingSession,
428+
sampleSenderBandwidthEstimationHandler));
429+
```
430+
353431
## Use Pre-generated Certificates
354432
The certificate generating function ([createCertificateAndKey](https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/Dtls__openssl_8c.html#a451c48525b0c0a8919a880d6834c1f7f)) in createDtlsSession() can take between 5 - 15 seconds in low performance embedded devices, it is called for every peer connection creation when KVS WebRTC receives an offer. To avoid this extra start-up latency, certificate can be pre-generated and passed in when offer comes.
355433
@@ -434,6 +512,32 @@ To disable threadpool, run `cmake .. -DENABLE_KVS_THREADPOOL=OFF`
434512

435513
Starting version 1.10.0, threadpool usage provides latency improvements in connection establishment. Note, that increasing the number of minimum threads can increase stack memory usage. So, ensure to increase with caution.
436514

515+
### Set up TWCC
516+
TWCC is a mechanism in WebRTC designed to enhance the performance and reliability of real-time communication over the Internet. TWCC addresses the challenges of network congestion by providing detailed feedback on the transport of packets across the network, enabling adaptive bitrate control and optimization of
517+
media streams in real-time. This feedback mechanism is crucial for maintaining high-quality audio and video communication, as it allows senders to adjust their transmission strategies based on comprehensive information about packet losses, delays, and jitter experienced across the entire transport path.
518+
The importance of TWCC in WebRTC lies in its ability to ensure efficient use of available network bandwidth while minimizing the negative impacts of network congestion. By monitoring the delivery of packets across the network, TWCC helps identify bottlenecks and adjust the media transmission rates accordingly.
519+
This dynamic approach to congestion control is essential for preventing degradation in call quality, such as pixelation, stuttering, or drops in audio and video streams, especially in environments with fluctuating network conditions. To learn more about TWCC, you can refer to the [RFC draft](https://datatracker.ietf.org/doc/html/draft-holmer-rmcat-transport-wide-cc-extensions-01)
520+
521+
In order to enable TWCC usage in the SDK, 2 things need to be set up:
522+
523+
1. Set the `disableSenderSideBandwidthEstimation` to FALSE. In our samples, the value is set using `enableTwcc` flag in `pSampleConfiguration`
524+
525+
```c
526+
pSampleConfiguration->enableTwcc = TRUE; // to enable TWCC
527+
pSampleConfiguration->enableTwcc = FALSE; // to disable TWCC
528+
configuration.kvsRtcConfiguration.disableSenderSideBandwidthEstimation = !pSampleConfiguration->enableTwcc;
529+
```
530+
531+
2. Set the callback that will have the business logic to modify the bitrate based on packet loss information. The callback can be set using `peerConnectionOnSenderBandwidthEstimation()`.
532+
533+
```c
534+
CHK_STATUS(peerConnectionOnSenderBandwidthEstimation(pSampleStreamingSession->pPeerConnection, (UINT64) pSampleStreamingSession,
535+
sampleSenderBandwidthEstimationHandler));
536+
```
537+
538+
By default, our SDK enables TWCC listener. The SDK has a sample implementation to integrate TWCC into the Gstreamer pipeline via the `sampleSenderBandwidthEstimationHandler` callback. To get more details, look for this specific callback.
539+
540+
437541
### Setting ICE related timeouts
438542
439543
There are some default timeout values set for different steps in ICE in the [KvsRtcConfiguration](https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/structKvsRtcConfiguration.html). These are configurable in the application. While the defaults are generous, there could be applications that might need more flexibility to improve chances of connection establishment because of poor network.

samples/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ link_directories(${OPEN_SRC_INSTALL_PREFIX}/lib)
5656
# copy sample frames to this subproject build folder, in case developer runs sample program with command `kvsWebrtcClientMaster` from `build/samples` dir.
5757
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/opusSampleFrames" DESTINATION .)
5858
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/h264SampleFrames" DESTINATION .)
59+
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/h265SampleFrames" DESTINATION .)
5960

6061
add_executable(
6162
kvsWebrtcClientMaster
@@ -78,13 +79,26 @@ if(GST_FOUND)
7879
add_executable(
7980
kvsWebrtcClientMasterGstSample
8081
Common.c
82+
GstAudioVideoReceiver.c
8183
kvsWebrtcClientMasterGstSample.c
8284
)
8385
target_link_libraries(kvsWebrtcClientMasterGstSample kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} ${GST_SAMPLE_LIBRARIES} kvsCommonLws kvspicUtils websockets)
8486

8587
install(TARGETS kvsWebrtcClientMasterGstSample
8688
RUNTIME DESTINATION bin
8789
)
90+
91+
add_executable(
92+
kvsWebrtcClientViewerGstSample
93+
Common.c
94+
GstAudioVideoReceiver.c
95+
kvsWebRTCClientViewerGstSample.c
96+
)
97+
target_link_libraries(kvsWebrtcClientViewerGstSample kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} ${GST_SAMPLE_LIBRARIES} kvsCommonLws kvspicUtils websockets)
98+
99+
install(TARGETS kvsWebrtcClientViewerGstSample
100+
RUNTIME DESTINATION bin
101+
)
88102
endif()
89103

90104
install(TARGETS kvsWebrtcClientMaster kvsWebrtcClientViewer discoverNatBehavior

0 commit comments

Comments
 (0)