awslabs / amazon-kinesis-video-streams-webrtc-sdk-c

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.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/group__PublicMemberFunctions.html
Apache License 2.0
1.01k stars 304 forks source link

[QUESTION] question for running multiple webrtc masters in a single IOT device #1095

Closed ajjiang48 closed 3 years ago

ajjiang48 commented 3 years ago

Hi, Sir, we are porting the webrtc master into our dash-cam device (the webrtc viewer had ported on it), Our dash-cam has 2~3 cameras and we'll need to run multiple webrtc master at the same time for sharing each camera's video to 1 or multiple webrtc viewers respectively. I have 2 questions as below:

  1. is it okay for running 2 or 3 webrtc master at the same time in the same dash-cam device (for our application, there may be 1 or more webrtc viewers connecting to anyone of the webrtc masters in the our dash-cam device) ?? if yes, is there any other restriction for it ??
  2. is it okay for running multiple webrtc master and 1 webrtc viewer at the same time in the same dash-cam device (for our application, the audio is dedicated for webrtc viewer and the video is dedicated for webrtc master) ??, also, if yes, is there any other restriction for it ??

Thanks, A.J.

hassanctech commented 3 years ago

There should be no restrictions here.

It maybe also possible for you to have a single master with 3 video transceivers and the viewer can request the particular video they want.

One thing I did not understand so you say audio is dedicated for viewer but video is dedicated for master? What do you mean by this? Does this mean master will SENDONLY audio and video and viewer will RECVONLY audio and video? Or something else?

This is important because we have a default setting for a maximum of 5 transceivers (for each master) so if you have 3 audio + 3 video in a single master then that will be 6, of course you can just increase the value but just something I wanted to make clear.

If performance / memory constraints are not an issue it may be easier to have 3 separate masters for each camera, it is up to you. @disa6302 If you have any other comments please share as well.

ajjiang48 commented 3 years ago

@hassanctech thank you for the answering.

I mean the viewer in our dash-cam only send/receive audio to/from the master; and the masters in our dash-cam only send video to the viewers (1 ~ N viewers). I have question for your sentence - " if you have 3 audio + 3 video in a single master then that will be 6,", do you mean it's a single webrtc connection with 3 video tracks and 3 audio tracks (using addTransceiver function to add into 1 streaming session) in the this streaming session ?? so, it's only 1 master with 3 pairs of video/audio source, not 3 masters, right? I don't know how the viewer could correctly parse the 3 video/audio streaming combined into 1 streaming session and if what my understanding is correct and it's achievable, I have another question => is this case testable using the webrtc test page ?? (we always use the webrtc test page as the golden test reference)

Thanks, A.J.

MushMal commented 3 years ago

I am afraid I don’t have a complete picture of what you are asking still. I would recommend you reading up on webrtc and experimenting. If you have architectural questions you can reach out to your AWS technical account management team for further help with the solution architecture.

Conceptually, you can have multiple viewers and multiple masters. You will need to understand why though as the master is designed to be a single instance serving multiple viewers. You will need to build your own application as the samples are not designed for that.

Resolving this issue as non specific. Please cut a separate issue with targeted asks which are actionable.

hassanctech commented 3 years ago

@ajjiang48 I did want to address your question about it being testable from the test page. You can locally modify the test page (right now you see it has 1 check box for audio and 1 for video), but can modify the JS code to for example try with 2 video streams. At some point I know @lherman-cs had a test version of this which might be a good starting point for you: https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-js/commit/8347d8c60866a7631a28ef773b7ba509f8c89ca3

When you send an offer each section (m-line) corresponds to an audio or video transceiver and has a corresponding mid you would need to keep the mapping consistent with the master side to identify the stream you want to request. I hope that makes sense.