-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from OpenNetLab/dev
- Loading branch information
Showing
16 changed files
with
413 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libx11-6 libgomp1 | ||
libx11-6 libgomp1 python3 | ||
|
||
COPY lib /usr/lib/ | ||
|
||
COPY bin /usr/bin/ | ||
|
||
COPY pylib /usr/lib/python3/dist-packages/ |
20 changes: 20 additions & 0 deletions
20
examples/peerconnection/serverless/corpus/BandwidthEstimator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
class Estimator(object): | ||
def report_states(self, stats: dict): | ||
''' | ||
stats is a dict with the following items | ||
{ | ||
"send_time_ms": uint, | ||
"arrival_time_ms": uint, | ||
"payload_type": int, | ||
"sequence_number": uint, | ||
"ssrc": int, | ||
"padding_length": uint, | ||
"header_length": uint, | ||
"payload_size": uint | ||
} | ||
''' | ||
pass | ||
|
||
def get_estimated_bandwidth(self)->int: | ||
return int(1e6) # 1Mbps |
54 changes: 54 additions & 0 deletions
54
examples/peerconnection/serverless/corpus/receiver_pyinfer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"serverless_connection": { | ||
"autoclose": 20, | ||
"sender": { | ||
"enabled": false | ||
}, | ||
"receiver": { | ||
"enabled": true, | ||
"listening_ip": "0.0.0.0", | ||
"listening_port": 8000 | ||
} | ||
}, | ||
"bwe_feedback_duration": 200, | ||
"video_source": { | ||
"video_disabled": { | ||
"enabled": true | ||
}, | ||
"webcam": { | ||
"enabled": false | ||
}, | ||
"video_file": { | ||
"enabled": false, | ||
"height": 240, | ||
"width": 320, | ||
"fps": 10, | ||
"file_path": "testmedia/test.yuv" | ||
} | ||
}, | ||
"audio_source": { | ||
"microphone": { | ||
"enabled": false | ||
}, | ||
"audio_file": { | ||
"enabled": true, | ||
"file_path": "testmedia/test.wav" | ||
} | ||
}, | ||
"save_to_file": { | ||
"enabled": true, | ||
"audio": { | ||
"file_path": "outaudio.wav" | ||
}, | ||
"video": { | ||
"width": 320, | ||
"height": 240, | ||
"fps": 10, | ||
"file_path": "outvideo.yuv" | ||
} | ||
}, | ||
"logging": { | ||
"enabled": true, | ||
"log_output_path": "webrtc.log" | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/peerconnection/serverless/corpus/sender_pyinfer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"serverless_connection": { | ||
"autoclose": 20, | ||
"sender": { | ||
"enabled": true, | ||
"dest_ip": "0.0.0.0", | ||
"dest_port": 8000 | ||
}, | ||
"receiver": { | ||
"enabled": false | ||
} | ||
}, | ||
"bwe_feedback_duration": 200, | ||
"video_source": { | ||
"video_disabled": { | ||
"enabled": false | ||
}, | ||
"webcam": { | ||
"enabled": false | ||
}, | ||
"video_file": { | ||
"enabled": true, | ||
"height": 240, | ||
"width": 320, | ||
"fps": 10, | ||
"file_path": "testmedia/test.yuv" | ||
} | ||
}, | ||
"audio_source": { | ||
"microphone": { | ||
"enabled": false | ||
}, | ||
"audio_file": { | ||
"enabled": true, | ||
"file_path": "testmedia/test.wav" | ||
} | ||
}, | ||
"save_to_file": { | ||
"enabled": false | ||
}, | ||
"logging": { | ||
"enabled": false | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/peerconnection/serverless/peerconnection_serverless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import sys | ||
import os | ||
import subprocess | ||
import traceback | ||
import json | ||
|
||
sys.path.append(os.getcwd()) | ||
|
||
import cmdinfer | ||
|
||
|
||
def main(): | ||
app = subprocess.Popen( | ||
["peerconnection_serverless.origin"] + sys.argv[1:], | ||
bufsize=1, | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.STDOUT) | ||
try: | ||
cmdinfer.main(app.stdout, app.stdin) | ||
app.wait() | ||
except: | ||
app.terminate() | ||
app.wait() | ||
error_message = traceback.format_exc() | ||
error_message = "\n{}".format(error_message) | ||
sys.stderr.write(error_message) | ||
if len(sys.argv[1:]) == 0: | ||
return | ||
config_file = sys.argv[1] | ||
config_file = json.load(open(config_file, "r")) | ||
if "logging" not in config_file: | ||
return | ||
if "enabled" not in config_file["logging"] or not config_file["logging"]["enabled"]: | ||
return | ||
with open(config_file["logging"]["log_output_path"], "a") as log_file: | ||
log_file.write(error_message) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.