Skip to content

awslabs/amazon-kinesis-video-streams-sdp

amazon-kinesis-video-streams-sdp

The goal of the SDP library is provide SDP Serializer and Deserializer functionalities.

What is SDP?

Session Description Protocol (SDP), described in RFC8866, is a format for describing multimedia communication sessions for the purposes of announcement and invitation. An SDP description consists of a number of lines of text of the form:

<type>=<value>

where <type> is exactly one case-significant character and <value> is structured text whose format depends on <type>. Here is an example of a SDP message:

v=0
o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5
s=SDP Seminar
i=A Seminar on the session description protocol
u=http://www.example.com/seminars/sdp.pdf
e=j.doe@example.com (Jane Doe)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
a=recvonly
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 99
a=rtpmap:99 h263-1998/90000

Using the library

Serializer

  1. Call SdpSerializer_Init to start creating an SDP message.
  2. Keep appending info by calling corresponding APIs:
    • To append string, call SdpSerializer_AddBuffer().
    • To append originator, call SdpSerializer_AddOriginator().
    • etc.
  3. Call SdpSerializer_Finalize() to get the result after serialization.

Deserializer

  1. Call SdpDeserializer_Init to start deserializing an SDP message.
  2. Keep calling SdpDeserializer_GetNext() to get next <type>=<value> in the SDP message.
  3. Call corresponding parse APIs to parse string into structure:
    • If return type is SDP_TYPE_ORIGINATOR, call SdpDeserializer_ParseOriginator().
    • If return type is SDP_TYPE_BANDWIDTH, call SdpDeserializer_ParseBandwidthInfo().
    • etc.
  4. Loop to step 2 till you get SDP_RESULT_MESSAGE_END.

Building Unit Tests

Platform Prerequisites

  • For running unit tests
    • C99 compiler like gcc
    • CMake 3.13.0 or later
    • Ruby 2.0.0 or later is additionally required for the CMock test framework (that we use).
  • For running the coverage target, gcov and lcov are additionally required.

Checkout CMock Submodule

By default, the submodules in this repository are configured with update=none in .gitmodules to avoid increasing clone time and disk space usage of other repositories.

To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule:

git submodule update --checkout --init --recursive test/CMock

Steps to build Unit Tests

  1. Go to the root directory of this repository. (Make sure that the CMock submodule is cloned as described in Checkout CMock Submodule).

  2. Run the following command to generate Makefiles:

    cmake -S test/unit-test -B build/ -G "Unix Makefiles" \
     -DCMAKE_BUILD_TYPE=Debug \
     -DBUILD_CLONE_SUBMODULES=ON \
     -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG'
    
  3. Run the following command to build the library and unit tests:

    make -C build all
    
  4. Run the following command to execute all tests and view results:

    cd build && ctest -E system --output-on-failure
    

Steps to generate code coverage report of Unit Test

  1. Run Unit Tests in Steps to build Unit Tests.

  2. Generate coverage.info in build folder:

    make coverage
    
  3. Get code coverage by lcov:

    lcov --rc lcov_branch_coverage=1 -r coverage.info -o coverage.info '*test*' '*CMakeCCompilerId*' '*mocks*'
    
  4. Generage HTML report in folder CodecovHTMLReport:

    genhtml --rc lcov_branch_coverage=1 --ignore-errors source coverage.info --legend --output-directory=CodecovHTMLReport
    

Script to run Unit Test and generate code coverage report

git submodule update --init --recursive --checkout test/CMock
cmake -S test/unit-test -B build/ -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG'
make -C build all
cd build
ctest -E system --output-on-failure
make coverage
lcov --rc lcov_branch_coverage=1 -r coverage.info -o coverage.info '*test*' '*CMakeCCompilerId*' '*mocks*'
genhtml --rc lcov_branch_coverage=1 --ignore-errors source coverage.info --legend --output-directory=CodecovHTMLReport

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published