Giter VIP home page Giter VIP logo

amazon-kinesis-video-streams-webrtc-sdk-c-for-freertos's Introduction

amazon-kinesis-video-streams-webrtc-sdk-c-for-freertos

This project demonstrate how to port Amazon Kinesis Video WebRTC C SDK to FreeRTOS. It uses the ESP-Wrover-Kit as a reference platform. You may follow the same procedure to port to other hardware platforms.

Clone projects

Please git clone this project using the command below. This will git sub-module all depended submodules under main/lib.

git submodule update --init --recursive

Reference platform

We use ESP IDF 4.3.1 and the ESP-Wrover-Kit as the reference platform. Please follow the Espressif instructions to set up the environment.

There is one modification you need to apply to the ESP IDF.

We have used mbedtls-2.16.11-idf in this project.

WebRTC needs the functionality of DTLS-for-SRTP (RFC5764). mbedTLS does not support this specification when this project was created. There is one pull request in mbedTLS (#3235) in progress for adding that support. Before mbedTLS adopts that pull request, we need to apply it on top of mbedtls-2.16.11-idf. If your IDF installation has a mbedTLS version lower than 2.16.11-idf, please upgrade it.

In this project, we have included all patches from the pull request pr1813-2.16.6 under the patches/mbedtls directory, therefore you do not need to pull those patches by yourself.

Apply the patch located in the patch/mbedtls directory of this project.

esp-idf/components/mbedtls/mbedtls$ git am your_demo_path/patch/mbedtls/*

Apply patches

Next, patch depended libraries for using with WebRTC.

This project uses wslay as the websocket client. Please apply patches located in patch/wslay directory.

main/lib/wslay$ git am ../../../patch/wslay/*

This project uses v2.3.0 of libsrtp. Please apply patches located in patch/libsrtp directory.

main/lib/libsrtp$ git am ../../../patch/libsrtp/*

This has been described in the “Reference platform” section above.

Please apply patches as below.

main/lib/usrsctp$ git am ../../../patch/usrsctp/*

If you run into problems when "git am" patches, you can use the following commands to resolve the problem. Or try "git am --abort" the process of git am, then "git apply" individual patches sequentially (in the order of the sequence number indicated by the file name).

$git apply --reject ../../../patch/problem-lib/problems.patch
// fix *.rej
$git add .
$git am --continue

Configure the project

Use menuconfig of ESP IDF to configure the project.

idf.py menuconfig
  • These parameters under Example Configuration Options must be set.

    • ESP_WIFI_SSID
    • ESP_WIFI_PASSWORD
    • ESP_MAXIMUM_RETRY
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION
    • AWS_KVS_CHANNEL
    • AWS_KVS_LOG_LEVEL
  • The modifications needed by this project can be seen in the sdkconfig file located at the root directory.

Video source

This project uses pre-recorded h.264 frame files for video streaming. Please put the files on a SD card. The files should look like:

/sdcard/h264SampleFrames/frame-%04d.h264.

The “%04d” part of the file name should be replaced by a sequence number of the frame.

Please note that you can not use J-TAG and SD card simultaneously on ESP-Wrover-Kit because they share some pins.

Generate video source

Given a video file videotestsrc, the following GStreamer command generates video frame files. If you want to reduce the number of video files, please modify related setting in sample code.

sh
gst-launch-1.0 videotestsrc pattern=ball num-buffers=1500 ! timeoverlay ! videoconvert ! video/x-raw,format=I420,width=1280,height=720,framerate=5/1 ! queue ! x264enc bframes=0 speed-preset=veryfast bitrate=128 byte-stream=TRUE tune=zerolatency ! video/x-h264,stream-format=byte-stream,alignment=au,profile=baseline ! multifilesink location="frame-%04d.h264" index=1

Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide of ESP IDF for full steps to configure and use ESP-IDF to build projects.

Known limitations and issues

This project does not use audio at this point of time. When running on the ESP-Wrover-Kit, this project can only run at low frame rate and low bit rate.

The current implementation does not support data channel. Please check back later for availability of the data channel feature.

The m-line mismatch

When using the WebRTC SDK Test Page to validate the demo, you may get m-line mismatch errors. Different browsers have different behaviors. To work around such errors, you need to run the sample in amazon-kinesis-video-streams-webrtc-sdk-js, and disable audio functionality of audio. This patch disables the audio functionality. A later release of this project may eliminate the need for this.

patch/amazon-kinesis-video-streams-webrtc-sdk-js/0001-diable-offerToReceiveAudio.patch`

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

amazon-kinesis-video-streams-webrtc-sdk-c-for-freertos's People

Contributors

amazon-auto avatar ycyang1229 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.