Code Monkey home page Code Monkey logo

awslabs / amazon-kinesis-video-streams-webrtc-sdk-c Goto Github PK

View Code? Open in Web Editor NEW
997.0 52.0 299.0 625.65 MB

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video, audio to Kinesis Video Streams.

Home Page: https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/group__PublicMemberFunctions.html

License: Apache License 2.0

CMake 1.02% C 62.12% C++ 36.45% Shell 0.33% Python 0.07%
kinesis-video-streams webrtc-sdk webrtc

amazon-kinesis-video-streams-webrtc-sdk-c's Issues

Enable EOR for SCTP

Currently we don't support EOR, you can read it about it here

Until we do our message size is capped at a single SCTP CHUNK.

Can we store the streamed videos?

Hi,

Are the videos stored anywhere (as in normal KVS)? Can we access the previously streamed video using something like GetMedia or HLS Session?

I am able to stream using Raspberry Pi and Mac and able to view only when the session is active.

The status is ICE_AGENT_STATE_READY, but the web test page has no images

HI:

I'm using the aws-sdk-kvs /2.1.0 migration to the MIPS platform.

The output information of Internet of things devices is as follows:

2020-01-07 10:13:46 DEBUG   turnConnectionStepState(): TurnConnection state changed from TURN_STATE_BIND_CHANNEL to TURN_STATE_READY
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   turnConnectionHandleChannelDataTcpMode(): operation returned status code: 0x5a000024
2020-01-07 10:13:46 DEBUG   turnConnectionIncomingDataHandler(): operation returned status code: 0x5a000024
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   turnConnectionHandleChannelDataTcpMode(): operation returned status code: 0x5a000024
2020-01-07 10:13:46 DEBUG   turnConnectionIncomingDataHandler(): operation returned status code: 0x5a000024
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   handleStunPacket(): Dropping response packet because transaction id does not match
2020-01-07 10:13:46 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000004, Next state: 0x0000000000000008
2020-01-07 10:13:46 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_CHECK_CONNECTION to ICE_AGENT_STATE_CONNECTED.
2020-01-07 10:13:46 DEBUG   onConnectionStateChange(): New connection state 3
2020-01-07 10:13:46 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000008, Next state: 0x0000000000000020
2020-01-07 10:13:46 DEBUG   executeReadyIceAgentState(): Selected pair ip address: 34.215.13.39, port 65470, local candidate type: relay
2020-01-07 10:13:46 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_CONNECTED to ICE_AGENT_STATE_READY.
2020-01-07 10:13:51 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:14:01 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:14:11 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:14:22 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:14:33 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:14:43 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:14:54 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:15:04 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-07 10:15:15 DEBUG   lwsWssCallbackRoutine(): Client is writable

mips_0x0000000f_20200107.txt

mips_ICE_AGENT_STATE_READY_20200107.txt

The usage method is the same as Ubuntu, using the resource file h264SampleFrames&opusSampleFrames that comes with the SDK

What is the cause of this, thank you!

Validate input media

We should explore adding some basic input validation for H264/VP8/Opus. Full validation isn't needed, but just enough to assert that the bitstream looks ok.

Maybe this should be a debug only feature? On constrained devices this might be costly.

Packet dropped by kernel silently

Hi, I encountered packet drop issue on my Ubuntu 18.04 machine, which turned out be network config problem, my solution was sysctl -w net.core.rmem_default=262144 to increase the socket buffer size. In real life, the I frame could be pretty big, I am thinking maybe the software should check and increase the kernel socket buffer size, to avoid weird and unnecessary packet drops, please comment.

Use non-blocking socket

If I read the code correcly. FIONBIO (non-blocking socket) was not used.
So during writeFrame in https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/master/samples/kvsWebRTCClientMaster.c#L192
And the underlying layer simply called send.
If only one client network connection was blocked, it will blocked all other clients, since the sample use a simple for-loop calling writeFrame to all connected clients and the underlying layer does not use non-blocking socket.

It will makes all clients have videos degraded if only one client had bad network connection.

Enable all compiler warnings

Currently unable to build. These are all the blocking issues.

  • Remove -Wgnu-zero-variadic-macro-arguments suppression from Include_i.h

Signalling Reconnection Failure

Steps to repro

  • start kvsWebrtcClientMaster sample, but dont start any viewer
  • wait for 5 min. After around 5min, there should be log showing signaling tries to refresh iceServers.
  • Start the viewer
    • expected outcome: master receives the offer and starts streaming
    • actual outcome: master doesnt receive anything.

Cross-compile build in docker

Hi! I have simple Dockerfile with arm toolchain

FROM debian

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y install \
    build-essential cmake gawk libncurses-dev libc6-dev intltool python \
    git subversion time unzip zlib1g-dev libssl-dev wget curl cpio bc \
    gettext gettext-base liblocale-gettext-perl upx \
    flex texinfo help2man libtool-bin byacc bison pkg-config libyaml-dev

WORKDIR /root/
RUN git clone https://github.com/crosstool-ng/crosstool-ng
WORKDIR /root/crosstool-ng
RUN ./bootstrap
RUN ./configure && make && make install 
RUN ct-ng arm-unknown-linux-uclibcgnueabi
RUN ct-ng build

# Now we have toolchain in /root/x-tools/arm-unknown-linux-uclibcgnueabi/

# git clone or copy aws_webrtc repo
COPY ./aws_webrtc /src/aws_webrtc
WORKDIR /src/aws_webrtc

# How can i start cmake to build aws webrtc with my own toolchain?

I tried to set ENV

ENV TARGET arm-unknown-linux-uclibcgnueabi
ENV CC /root/x-tools/arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux-uclibcgnueabi-gcc
ENV AR /root/x-tools/arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux-uclibcgnueabi-ar

but cmake can't to build openssl. It is trying to set -m64 for arm-unknown-linux-uclibcgnueabi-gcc

Can you explain how to build AWS webrtc inside a docker container?
Maybe i need to do it with a different way?
Thanks!

signaling channel crash

Websocket is not properly established. singaling channel code tried again, and then segfault.
Backtracce is as the following:

2020-01-15 00:06:46 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
2020-01-15 00:06:46 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000004
2020-01-15 00:06:47 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000004, Next state: 0x0000000000000010
2020-01-15 00:06:47 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000020
2020-01-15 00:06:48 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000040
2020-01-15 00:06:48 INFO    signalingClientConnectSync(): Signaling Client Connect Sync
2020-01-15 00:06:48 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
2020-01-15 00:06:53 ERROR   connectSignalingChannelLws(): operation returned status code: 0x0000000f
2020-01-15 00:06:53 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000004
2020-01-15 00:06:53 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000004, Next state: 0x0000000000000010
2020-01-15 00:06:54 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000020
2020-01-15 00:06:55 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000040
2020-01-15 00:06:55 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
2020-01-15 00:06:55 WARN    lwsWssCallbackRoutine(): Client connection failed. Connection error string: closed before established
2020-01-15 00:06:56 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000004
2020-01-15 00:06:57 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000004, Next state: 0x0000000000000010
2020-01-15 00:06:57 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000020
2020-01-15 00:06:58 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000040
2020-01-15 00:06:58 INFO    stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
./webrtc(_Z15segsegv_handleri+0x4a)[0x5649f3a456da]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f7eb88cef20]
./libkvsWebrtcSignalingClient.so(lwsWssCallbackRoutine+0xe2)[0x7f7eb9bf4c7d]
/home/weizhang/git/kvs-x86/open-source/local/lib/libwebsockets.so.15(+0x111a8)[0x7f7eb7ad71a8]
/home/weizhang/git/kvs-x86/open-source/local/lib/libwebsockets.so.15(+0x1581f)[0x7f7eb7adb81f]
/home/weizhang/git/kvs-x86/open-source/local/lib/libwebsockets.so.15(+0x2b6e3)[0x7f7eb7af16e3]
/home/weizhang/git/kvs-x86/open-source/local/lib/libwebsockets.so.15(lws_service+0x45)[0x7f7eb7adb675]
./libkvsWebrtcSignalingClient.so(lwsCompleteSync+0x4c3)[0x7f7eb9bf5a4c]
./libkvsWebrtcSignalingClient.so(lwsListenerHandler+0xdc)[0x7f7eb9bf8b0d]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f7eb97cf6db]

Do it fall back to use turn server automatically ?

We notice that STATUS createSampleConfiguration(PCHAR channelName, SIGNALING_CHANNEL_ROLE_TYPE roleType, BOOL trickleIce, BOOL useTurn, PSampleConfiguration* ppSampleConfiguration)
It needs to specify useTURN or not.

Doesn't the sdk SHOULD fall back to use TURN server automatically when p2p between device cannot be reached ? If so, why there is a setting or that .

Make ICE timing configurable

Users may have unique requirements in certain networks, we should make the following configurable per PeerConnection

  • ICE timeout intervals (may prefer to fail fast)
  • Polling Intervals (May have a very lossy network, or working in a network constrained env)
  • Custom configuration for nomination (how soon till we nominate, if we use TURN and don't even attempt host/reflexive candidates)

Build error on macOS

My attempt to build the SDK on mac failed with an error.

  • Repo rev: 59236d7
  • XCode version: 11.3, Build version 11C29

The error log:

$ make
 :
[ 60%] Linking C shared library libkvsWebrtcSignalingClient.dylib
ld: warning: ignoring file ../open-source/local/lib/libjsmn.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture x86_64:
  "_jsmn_init", referenced from:
      _receiveLwsMessage in LwsApiCalls.c.o
      _describeChannelLws in LwsApiCalls.c.o
      _createChannelLws in LwsApiCalls.c.o
      _getChannelEndpointLws in LwsApiCalls.c.o
      _getIceConfigLws in LwsApiCalls.c.o
  "_jsmn_parse", referenced from:
      _receiveLwsMessage in LwsApiCalls.c.o
      _describeChannelLws in LwsApiCalls.c.o
      _createChannelLws in LwsApiCalls.c.o
      _getChannelEndpointLws in LwsApiCalls.c.o
      _getIceConfigLws in LwsApiCalls.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libkvsWebrtcSignalingClient.dylib] Error 1
make[1]: *** [CMakeFiles/kvsWebrtcSignalingClient.dir/all] Error 2
make: *** [all] Error 2

What I did:

git clone --recursive [email protected]:awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.git
cd amazon-kinesis-video-streams-webrtc-sdk-c
mkdir -p build
cd build
cmake ..
make

Allow MTU to be configured by user

We should think about the API looks like, but we should allow the user to configure the MTU if they want.

Some users will be in constrained environments, and they know best the setup that works for them.

Implement congestion control

We should then emit feedback back to the user so they can interact with their encoder.

We should also update the GStreamer sample to send events to the pipeline with bitrate suggestions.

Don't use PiC functions in samples

We don't want to push users to write code a certain way when using our samples, we should rewrite to look like idiomatic C.

We can keep the same patterns of CleanUp: but CHK_STATUS and other things like that should be avoided.

print success messages in samples, unrelated to logging levels

So users know that things are working we should print success messages directly in the samples.

If they wish to delete those lines they can delete them from their code, but they shouldn't be controlled by logging levels so they are always printed. We want to have very minimal console spew (just success messages) in the default case.

(BUG) CHK_WARN CHK_ERR should not be inside MUTEX_LOCK

There are many case where CHK_WARN or CHK_ERR or CKH_STATUS are inside a MUTEX_LOCK block, which would skip the mutex unlock when error occurs.

Such as : https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/master/samples/Common.c#L109 AND https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/master/samples/Common.c#L114

The CHK_WARN, CHK_ERR just use a goto cleanup when error occurs, and will not unlock the mutex.

Pls make some test cases and polish the code.

IPv6 Support

We need IPv6 support, we should allow the user to opt in/out. In some cases you have IPv6, but all packets are discarded so just causes spam in the logs.

ICE connection succeeded but TURN connection timed out causing continuous printing

Reconnect successfully after ICE connection timeout , it is still printing as follows before disconnecting.

2019-12-19 12:56:40 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:40 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   onIceCandidateHandler(): ice candidate gathering finished
2019-12-19 12:56:41 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000004
2019-12-19 12:56:41 DEBUG   executeCheckConnectionIceAgentState(): ice candidate pair count 18
2019-12-19 12:56:41 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_GATHERING to ICE_AGENT_STATE_CHECK_CONNECTION.
2019-12-19 12:56:41 DEBUG   onConnectionStateChange(): New connection state 2
2019-12-19 12:56:41 DEBUG   handleStunPacket(): local candidate ip address does not match with xor mapped address in binding response
2019-12-19 12:56:41 DEBUG   iceAgentCheckPeerReflexiveCandidate(): New local peer reflexive candidate found
2019-12-19 12:56:41 DEBUG   handleStunPacket(): received candidate with USE_CANDIDATE flag, local candidate type prflx.
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000004, Next state: 0x0000000000000008
2019-12-19 12:56:41 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_CHECK_CONNECTION to ICE_AGENT_STATE_CONNECTED.
2019-12-19 12:56:41 DEBUG   onConnectionStateChange(): New connection state 3
2019-12-19 12:56:41 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000008, Next state: 0x0000000000000020
2019-12-19 12:56:41 DEBUG   executeReadyIceAgentState(): Selected pair ip address: 192.168.2.106, port 59692, local candidate type: prflx
2019-12-19 12:56:41 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_CONNECTED to ICE_AGENT_STATE_READY.
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:41 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:42 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020
2019-12-19 12:56:42 DEBUG   turnConnectionStepState(): TurnConnection in TURN_STATE_FAILED due to 0x5a000020

Allow user greater control during certificate generation.

It took at least 5s to generate key with 2048 bits, is there any problem if I use 1024? If I use 1024 it only takes about 1 second. This will help me to preview the video faster.

GCC/4.6.1 Linux/3.4.43-gk armv6l

10:10:42  Jiang createCertificateAndKey RSA_generate_key_ex[97]
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 8
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client receive {"messagePayload":"eyJjYW5kaWRhdGUiOiJjYW5kaWRhdGU6MzQwMjEzMDIyMiAxIHVkcCAzMzU2MjYyMyAzLjIzMS40Ljk5IDUxNjc0IHR5cCByZWxheSByYWRkciAxMTguMTkxLjIyNC4xNTEgcnBvcnQgMTM3NTYgZ2VuZXJhdGlvbiAwIHVmcmFnIERQa2cgbmV0d29yay1jb3N0IDk5OSIsInNkcE1pZCI6IjAiLCJzZHBNTGluZUluZGV4IjowfQ==","messageType":"ICE_CANDIDATE","senderClientId":"danspehvserjxl01kuledj"}
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 10
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client is writable
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 8
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client receive {"messagePayload":"eyJjYW5kaWRhdGUiOiJjYW5kaWRhdGU6MzQwMjEzMDIyMiAxIHVkcCAzMzU2MjYyMyAzLjIzMS40Ljk5IDQ5OTk1IHR5cCByZWxheSByYWRkciAxMTguMTkxLjIyNC4xNTEgcnBvcnQgMTM3NTggZ2VuZXJhdGlvbiAwIHVmcmFnIERQa2cgbmV0d29yay1jb3N0IDk5OSIsInNkcE1pZCI6IjEiLCJzZHBNTGluZUluZGV4IjoxfQ==","messageType":"ICE_CANDIDATE","senderClientId":"danspehvserjxl01kuledj"}
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 10
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client is writable
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 8
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client receive {"messagePayload":"eyJjYW5kaWRhdGUiOiJjYW5kaWRhdGU6MzM2OTI2NjI2MyAxIHVkcCAzMzU2MjM2NyAzLjIwOC4zMC4xOTggNTcxODQgdHlwIHJlbGF5IHJhZGRyIDExOC4xOTEuMjI0LjE1MSBycG9ydCAxMzc1NyBnZW5lcmF0aW9uIDAgdWZyYWcgRFBrZyBuZXR3b3JrLWNvc3QgOTk5Iiwic2RwTWlkIjoiMSIsInNkcE1MaW5lSW5kZXgiOjF9","messageType":"ICE_CANDIDATE","senderClientId":"danspehvserjxl01kuledj"}
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 10
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client is writable
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 8
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client receive {"messagePayload":"eyJjYW5kaWRhdGUiOiJjYW5kaWRhdGU6MzM2OTI2NjI2MyAxIHVkcCAzMzU2MjM2NyAzLjIwOC4zMC4xOTggNTU3ODUgdHlwIHJlbGF5IHJhZGRyIDExOC4xOTEuMjI0LjE1MSBycG9ydCAxMzc1NSBnZW5lcmF0aW9uIDAgdWZyYWcgRFBrZyBuZXR3b3JrLWNvc3QgOTk5Iiwic2RwTWlkIjoiMCIsInNkcE1MaW5lSW5kZXgiOjB9","messageType":"ICE_CANDIDATE","senderClientId":"danspehvserjxl01kuledj"}
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): WSS callback with reason 10
10:10:42  2019-12-28 02:10:38 VERBOSE lwsWssCallbackRoutine(): Client is writable
10:10:44  
10:10:44  
10:10:47  Jiang createCertificateAndKey RSA_generate_key_ex[99]
10:10:47  2019-12-28 02:10:43 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_NONE to ICE_AGENT_STATE_NEW.

sendto: "No route to host" in iceUtilsSendStunPacket, getInt16 on macos

Hi! I'm tying to use aws webrtc with my own signal channel via mqtt
I get an infinite loop with error "sendto: No route to host" when i set remote offer to local peerclient

configuration.iceServers[0].urls: stun:stun.l.google.com:19302
2020-01-09 21:52:14 DEBUG   iceAgentValidateKvsRtcConfig(): 
	iceLocalCandidateGatheringTimeout: 10000 ms
	iceConnectionCheckTimeout: 10000 ms
	iceCandidateNominationTimeout: 10000 ms
	iceConnectionCheckPollingInterval: 50 ms
2020-01-09 21:52:14 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_NONE to ICE_AGENT_STATE_NEW.
2020-01-09 21:52:14 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
2020-01-09 21:52:14 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_NEW to ICE_AGENT_STATE_GATHERING.
2020-01-09 21:52:14 DEBUG   onConnectionStateChange(): New connection state 1
2020-01-09 21:52:14 DEBUG   socketConnectionSendData(): sendto data failed with errno No route to host
2020-01-09 21:52:14 DEBUG   iceUtilsSendStunPacket(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   iceAgentStateGatheringTimerCallback(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   timerQueueExecutor(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   updateCandidateAddress(): New server reflexive candidate found
2020-01-09 21:52:14 DEBUG   socketConnectionSendData(): sendto data failed with errno No route to host
2020-01-09 21:52:14 DEBUG   iceUtilsSendStunPacket(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   iceAgentStateGatheringTimerCallback(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   timerQueueExecutor(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   socketConnectionSendData(): sendto data failed with errno No route to host
2020-01-09 21:52:14 DEBUG   iceUtilsSendStunPacket(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   iceAgentStateGatheringTimerCallback(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   timerQueueExecutor(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   socketConnectionSendData(): sendto data failed with errno No route to host
2020-01-09 21:52:14 DEBUG   iceUtilsSendStunPacket(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   iceAgentStateGatheringTimerCallback(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   timerQueueExecutor(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   socketConnectionSendData(): sendto data failed with errno No route to host
2020-01-09 21:52:14 DEBUG   iceUtilsSendStunPacket(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   iceAgentStateGatheringTimerCallback(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   timerQueueExecutor(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   socketConnectionSendData(): sendto data failed with errno No route to host
2020-01-09 21:52:14 DEBUG   iceUtilsSendStunPacket(): operation returned status code: 0x5800001a
2020-01-09 21:52:14 DEBUG   iceAgentStateGatheringTimerCallback(): operation returned status code: 0x5800001a

i found this line

pIceServer->ipAddress.port = (UINT16) getInt16((INT16) port);

and run simple check:

    printf("port %d\n", port);
    pIceServer->ipAddress.port = (UINT16) getInt16((INT16) port);
    printf("pIceServer->ipAddress.port %d\n", pIceServer->ipAddress.port);

output:

port 19302
pIceServer->ipAddress.port 26187

Is it correct value? My platform is macos core i7 intel 64bit
when i removed getInt16 call i still getting the same infinite loop..

Do you have any plans to create minimal samples without signal library?
for example peer 2 peer datachannel like in pion library with simple copy/paste offers in console or maby only one sender in C and js on jsfiddle as client with copy/paste as signal channel?
I will trying to build something like that

Connection timed out

I successfully compiled on arm64, but am unable to run any of the three samples without a connection timeout.

:~/amazon-kinesis-video-streams-webrtc-sdk-c/build$ AWS_ACCESS_KEY_ID="access" AWS_SECRET_ACCESS_KEY="secret" REGION_NAME="us-west-2" ./kvsWebrtcClientMasterGstSample demo2
[KVS GStreamer Master] Using trickleICE by default
[KVS GStreamer Master] Created signaling channel demo2
[KVS Gstreamer Master] Finished initializing GStreamer
[KVS Gstreamer Master] Streaming video only
[KVS GStreamer Master] KVS WebRTC initialization completed successfully
[KVS GStreamer Master] Signaling client created successfully
[KVS GStreamer Master] Signaling client connection to socket established
[KVS Gstreamer Master] Beginning streaming...check the stream over channel demo2
2020-01-15 00:49:10 DEBUG   iceAgentValidateKvsRtcConfig(): 
	iceLocalCandidateGatheringTimeout: 10000 ms
	iceConnectionCheckTimeout: 10000 ms
	iceCandidateNominationTimeout: 10000 ms
	iceConnectionCheckPollingInterval: 50 ms
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client receive {"messagePayload":"[...snip...]","messageType":"ICE_CANDIDATE","senderClientId":"ik44sfhawixoqeq1zfu"}
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_NONE to ICE_AGENT_STATE_NEW.
2020-01-15 00:49:10 INFO    signalingClientSendMessageSync(): Signaling Client Sending Message Sync
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
 {"messagePayload":"[...snip...]","messageType":"ICE_CANDIDATE","senderClientId":"ik44sfhawixoqeq1zfu"}
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 DEBUG   stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
2020-01-15 00:49:10 INFO    signalingClientSendMessageSync(): Signaling Client Sending Message Sync
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 INFO    signalingClientSendMessageSync(): Signaling Client Sending Message Sync
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 INFO    signalingClientSendMessageSync(): Signaling Client Sending Message Sync
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client receive 
2020-01-15 00:49:10 WARN    receiveLwsMessage(): Signaling received an empty message
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client receive 
2020-01-15 00:49:10 WARN    receiveLwsMessage(): Signaling received an empty message
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client receive 
2020-01-15 00:49:10 WARN    receiveLwsMessage(): Signaling received an empty message
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client receive 
2020-01-15 00:49:10 WARN    receiveLwsMessage(): Signaling received an empty message
2020-01-15 00:49:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:20 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:30 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:40 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:49:50 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:50:00 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:50:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:50:20 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:50:30 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:50:40 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:50:50 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:51:00 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:51:10 DEBUG   lwsWssCallbackRoutine(): Client is writable
2020-01-15 00:51:17 WARN    createSocket(): connect() failed with errno Connection timed out
2020-01-15 00:51:17 ERROR   createSocketConnection(): operation returned status code: 0x5800001d
2020-01-15 00:51:17 ERROR   turnConnectionStepState(): operation returned status code: 0x5800001d
2020-01-15 00:51:17 DEBUG   turnConnectionStepState(): TurnConnection state changed from TURN_STATE_NEW to TURN_STATE_FAILED
2020-01-15 00:51:17 ERROR   turnConnectionStart(): operation returned status code: 0x5800001d
2020-01-15 00:51:17 ERROR   executeGatheringIceAgentState(): operation returned status code: 0x5800001d

My device has internet access, definitely reacts to the presence of an available client (such as the browser-viewer on the AWS console), but is never able to send data. The client also never detects a connection.

At first I wondered if it was a firewall issue, but the kvs examples do work on my desktop machine, which is behind the same firewall.

I have also tested that gstreamer is working correctly on my arm64 device, as I can create a regular RTP video stream from it to my desktop (on the same LAN).

Any tips? I am not quite sure how to interpret the console log.

Thanks!

can't resolve symbol 'HMAC_CTX_new' (linux-mips32)

Hi, I cross-compiled the program and run on linux-mips32 platform , then I got ./kvsWebrtcClientMaster: can't resolve symbol 'HMAC_CTX_new'.
I search the code related to "HMAC_CTX_new" , only find -DLWS_HAVE_HMAC_CTX_new=1 in libwebsockets-CMakeLists.txt . And google given little information.
May I kown the definition's effect ? And how can I handle it ?
Best Regards and Merry Christmas !

Enable MSAN

  • MSAN we need to build all libraries instrumented.

Sdk crashes when new PeerConnection establishes new connection

Steps to reproduce:

  • start kvsWebrtcClientMasterSample with any channel name.
  • start js viewer in any connection mode. Ensure data channel is enabled. Connection should be established successfully and starts streaming.
  • stop the js viewer.
  • wait until connectionStateChange callback is called and trigger peerConnection teardown, the following log should be seen
2019-12-07 01:53:57 DEBUG   main(): Completed freeing peerConnection and Reinitializing peerConnection
2019-12-07 01:53:57 VERBOSE signalingClientGetIceConfigInfoCout(): Signaling Client Get ICE Config Info Count
2019-12-07 01:53:57 VERBOSE signalingClientGetIceConfigInfo(): Signaling Client Get ICE Config Info
2019-12-07 01:53:57 DEBUG   stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_NONE to ICE_AGENT_STATE_NEW
  • start the js viewer again, then the program will crash.
  • stacktrace:
* thread #8, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
  * frame #0: 0x0000000100101c8d libkvsWebrtcClient.dylib`onSctpOutboundPacket(addr=0x0000000000000000, data=0x0000000100731940, length=16, tos='\0', set_df='\0') at Sctp.c:150:5
    frame #1: 0x0000000100387dbc libusrsctp.1.dylib`sctp_send_resp_msg(src=0x000070000b992ba0, dst=0x000070000b992b90, sh=0x000000010073cf60, vtag=4152928290, type='\x06', cause=0x0000000000000000, vrf_id=0, port=0) at sctp_output.c:12021:10
    frame #2: 0x000000010037ab15 libusrsctp.1.dylib`sctp_send_abort(m=0x000000010073cf10, iphlen=0, src=0x000070000b992ba0, dst=0x000070000b992b90, sh=0x000000010073cf60, vtag=4152928290, cause=0x0000000000000000, vrf_id=0, port=0) at sctp_output.c:13091:2
    frame #3: 0x000000010035eae9 libusrsctp.1.dylib`sctp_common_input_processing(mm=0x000070000b992b88, iphlen=0, offset=12, length=100, src=0x000070000b992ba0, dst=0x000070000b992b90, sh=0x000000010073cf60, ch=0x000000010073cf6c, compute_crc='\x01', ecn_bits='\0', vrf_id=0, port=0) at sctp_input.c:5843:5
    frame #4: 0x00000001003f3a7e libusrsctp.1.dylib`usrsctp_conninput(addr=0x0000000000000000, buffer=0x00000001021a7040, length=100, ecn_bits='\0') at user_socket.c:3518:2
    frame #5: 0x0000000100101cf4 libkvsWebrtcClient.dylib`putSctpPacket(pSctpSession=0x0000000000000000, buf="\x13\x88\x13\x88", bufLen=100) at Sctp.c:160:5
    frame #6: 0x00000001000ee5ed libkvsWebrtcClient.dylib`onInboundPacket(customData=4329910272, buff="\x13\x88\x13\x88", buffLen=157) at PeerConnection.c:86:13
    frame #7: 0x00000001000decbf libkvsWebrtcClient.dylib`incomingDataHandler(customData=4311989248, pSocketConnection=0x00000001007259c0, pBuffer="\x13\x88\x13\x88", bufferLen=157, pSrc=0x000070000b992e70, pDest=0x0000000000000000) at IceAgent.c:1297:9
    frame #8: 0x00000001000dc263 libkvsWebrtcClient.dylib`connectionListenerReceiveDataRoutine(arg=0x00000001021a7000) at ConnectionListener.c:282:25
    frame #9: 0x00007fff7cb572eb libsystem_pthread.dylib`_pthread_body + 126
    frame #10: 0x00007fff7cb5a249 libsystem_pthread.dylib`_pthread_start + 66
    frame #11: 0x00007fff7cb5640d libsystem_pthread.dylib`thread_start + 13

No package 'libsrtp2' found

I am following in devguide and get an error during the cmake .. step

~/aws2/amazon-kinesis-video-streams-webrtc-sdk-c/build$ cmake ..
-- Kinesis Video PIC path is /home/myuser/aws2/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-pic/
-- Kinesis Video C Producer path is /home/myuser/aws2/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-c-producer/
-- Kinesis Video WebRTC Client path is /home/myuser/aws2/amazon-kinesis-video-streams-webrtc-sdk-c
-- dependencies install path is /home/myuser/aws2/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/local
-- Bitness 64 bits
-- Checking for module 'libsrtp2'
--   No package 'libsrtp2' found
CMake Error at /usr/share/cmake-3.13/Modules/FindPkgConfig.cmake:452 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindPkgConfig.cmake:622 (_pkg_check_modules_internal)
  CMakeLists.txt:308 (pkg_check_modules)


-- Configuring incomplete, errors occurred!
See also "/home/myuser/aws2/amazon-kinesis-video-streams-webrtc-sdk-c/build/CMakeFiles/CMakeOutput.log".
See also "/home/myuser/aws2/amazon-kinesis-video-streams-webrtc-sdk-c/build/CMakeFiles/CMakeError.log".

This happens on an arm64 machine running Ubuntu Xenial 16.04. I did not have this problem on my laptop running 16.04, so I assume it is either arm64 related, or something wrong with my machine's configuration.

I'll keep digging, but any suggestions would be appreciated. I was assuming that these dependencies are built from source rather than installed, so I am surprised that it can't find libsrtp.

Unable to use WebRTC SDK Test Page for testing

Hi @Sean-Der

Follow the file README.md

`When the command line application prints Connection established, you can proceed to the next step.

Now that your signaling channel is created and the connected master is streaming media to it, you can view this stream. To do so, open the WebRTC SDK Test Page using the steps in Using the Kinesis Video Streams with WebRTC Test Page and set the following values using the same AWS credentials and the same signaling channel that you specified for the master above:

  • Access key ID
  • Secret access key
  • Signaling channel name
  • Client ID (optional)

Choose Start viewer to start live video streaming of the sample H264/Opus frames`

Ubuntu-16.04 log

Ubuntu_Unable-to-use-WebRTC_SDK_Test_Page-for-testing_20200109.txt

[WebRTC SDK Test Page] log

[2020-01-09T06:37:03.997Z] [INFO] Page loaded [2020-01-09T06:38:05.914Z] [INFO] [VIEWER] Channel ARN: arn:aws:kinesisvideo:us-west-2:380632319579:channel/ScaryTestChannel/1577439476380

This situation only appeared in the updated version on January 8, 2020, which did not exist before.
The original SDK version was updated on December 27, 2019

I think I need your help. Thank you.

Support non-rsize RTCP

Currently when we parse RTCP we only look at the first in the compound packet. Because of this NACKs only work with clients that support (breaking FireFox)

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.