Skip to content

Commit

Permalink
Merge branch 'master' into fix-dc
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry-tao committed Dec 15, 2022
2 parents cf5631b + 1c20cd4 commit b069de7
Show file tree
Hide file tree
Showing 50 changed files with 415 additions and 238 deletions.
23 changes: 10 additions & 13 deletions .github/generate-authors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
set -e

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"
GIT_WORKDIR=${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel)}
AUTHORS_PATH="${GIT_WORKDIR}/AUTHORS.txt"

if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
. ${SCRIPT_PATH}/.ci.conf
fi

Expand All @@ -31,8 +31,7 @@ EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion B
CONTRIBUTORS=()

shouldBeIncluded () {
for i in "${EXCLUDED_CONTRIBUTORS[@]}"
do
for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do
if [[ $1 =~ "$i" ]]; then
return 1
fi
Expand All @@ -42,25 +41,23 @@ shouldBeIncluded () {


IFS=$'\n' #Only split on newline
for contributor in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf)
do
if shouldBeIncluded $contributor; then
CONTRIBUTORS+=("$contributor")
for CONTRIBUTOR in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf); do
if shouldBeIncluded ${CONTRIBUTOR}; then
CONTRIBUTORS+=("${CONTRIBUTOR}")
fi
done
unset IFS

if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then
cat >$AUTHORS_PATH <<-'EOH'
cat >${AUTHORS_PATH} <<-'EOH'
# Thank you to everyone that made Pion possible. If you are interested in contributing
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
#
# This file is auto generated, using git to list all individuals contributors.
# see `.github/generate-authors.sh` for the scripting
EOH
for i in "${CONTRIBUTORS[@]}"
do
echo "$i" >> $AUTHORS_PATH
for i in "${CONTRIBUTORS[@]}"; do
echo "$i" >> ${AUTHORS_PATH}
done
exit 0
fi
6 changes: 3 additions & 3 deletions .github/install-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg"
cp "$SCRIPT_PATH/hooks/pre-commit.sh" "$SCRIPT_PATH/../.git/hooks/pre-commit"
cp "$SCRIPT_PATH/hooks/pre-push.sh" "$SCRIPT_PATH/../.git/hooks/pre-push"
cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push"
4 changes: 2 additions & 2 deletions .github/lint-commit-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if [ "$#" -eq 1 ]; then
fi
lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")"
else
for commit in $(git rev-list --no-merges origin/master..); do
lint_commit_message "$(git log --format="%B" -n 1 $commit)"
for COMMIT in $(git rev-list --no-merges origin/master..); do
lint_commit_message "$(git log --format="%B" -n 1 ${COMMIT})"
done
fi
29 changes: 12 additions & 17 deletions .github/lint-disallowed-functions-in-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,31 @@ set -e

# Disallow usages of functions that cause the program to exit in the library code
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
. ${SCRIPT_PATH}/.ci.conf
fi

EXCLUDE_DIRECTORIES=${DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES:-"examples"}
DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(' 'print(' 'println(')

files=$(
find "$SCRIPT_PATH/.." -name "*.go" \
FILES=$(
find "${SCRIPT_PATH}/.." -name "*.go" \
| grep -v -e '^.*_test.go$' \
| while read file
do
excluded=false
for ex in $EXCLUDE_DIRECTORIES
do
if [[ $file == */$ex/* ]]
then
excluded=true
| while read FILE; do
EXCLUDED=false
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
if [[ ${FILE} == */${EXCLUDE_DIRECTORY}/* ]]; then
EXCLUDED=true
break
fi
done
$excluded || echo "$file"
${EXCLUDED} || echo "${FILE}"
done
)

for disallowedFunction in "${DISALLOWED_FUNCTIONS[@]}"
do
if grep -e "\s$disallowedFunction" $files | grep -v -e 'nolint'; then
echo "$disallowedFunction may only be used in example code"
for DISALLOWED_FUNCTION in "${DISALLOWED_FUNCTIONS[@]}"; do
if grep -e "\s${DISALLOWED_FUNCTION}" ${FILES} | grep -v -e 'nolint'; then
echo "${DISALLOWED_FUNCTION} may only be used in example code"
exit 1
fi
done
8 changes: 4 additions & 4 deletions .github/lint-filename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ set -e
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$"

find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
filename=$(basename -- "$fullpath")
find "${SCRIPT_PATH}/.." -name "*.go" | while read FULLPATH; do
FILENAME=$(basename -- "${FULLPATH}")

if ! [[ $filename =~ $GO_REGEX ]]; then
echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported"
if ! [[ ${FILENAME} =~ ${GO_REGEX} ]]; then
echo "${FILENAME} is not a valid filename for Go code, only alpha, numbers and underscores are supported"
exit 1
fi
done
24 changes: 10 additions & 14 deletions .github/lint-no-trailing-newline-in-log-messages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,25 @@ set -e

# Disallow usages of functions that cause the program to exit in the library code
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
. ${SCRIPT_PATH}/.ci.conf
fi

files=$(
find "$SCRIPT_PATH/.." -name "*.go" \
| while read file
do
excluded=false
for ex in $EXCLUDE_DIRECTORIES
do
if [[ $file == */$ex/* ]]
then
excluded=true
FILES=$(
find "${SCRIPT_PATH}/.." -name "*.go" \
| while read FILE; do
EXCLUDED=false
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
if [[ $file == */${EXCLUDE_DIRECTORY}/* ]]; then
EXCLUDED=true
break
fi
done
$excluded || echo "$file"
${EXCLUDED} || echo "${FILE}"
done
)

if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' $files | grep -v -e 'nolint'; then
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' ${FILES} | grep -v -e 'nolint'; then
echo "Log format strings should have trailing new-line"
exit 1
fi
19 changes: 19 additions & 0 deletions .github/workflows/examples-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Examples Tests
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
pion-to-pion-test:
name: Test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: test
run: cd examples/pion-to-pion && ./test.sh

25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: release
on:
push:
tags:
- 'v*'

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '1.18' # auto-update/latest-go-version
- name: Build and release
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.17", "1.18"]
go: ["1.17", "1.18"] # auto-update/supported-go-version-list
fail-fast: false
name: Go ${{ matrix.go }}
steps:
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.17", "1.18"]
go: ["1.17", "1.18"] # auto-update/supported-go-version-list
fail-fast: false
name: Go i386 ${{ matrix.go }}
steps:
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
- name: Download Go
run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
env:
GO_VERSION: 1.17
GO_VERSION: 1.17 # auto-update/latest-go-version

- name: Set Go Root
run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tidy-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17 # auto-update/latest-go-version
- name: check
run: |
go mod download
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
builds:
- skip: true
5 changes: 5 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ donotanswer <viktor.ferter@doclerholding.com>
earle <aguilar@dm.ai>
Egon Elbre <egonelbre@gmail.com>
Eric Daniels <eric@erdaniels.com>
Eric Fontaine <ericfontainejazz@gmail.com>
feixiao <feixiao2020@sina.com>
Forest Johnson <forest.n.johnson@gmail.com>
frank <frank@huzhedeMacBook-Pro.local>
Expand Down Expand Up @@ -117,6 +118,7 @@ Michiel De Backker <38858977+backkem@users.noreply.github.com>
Mike Coleman <mc@fivebats.com>
Mindgamesnl <matsmoolhuizen@gmail.com>
mission-liao <missionaryliao@gmail.com>
mr-shitij <21.shitijagrawal@gmail.com>
mxmCherry <mxmCherry@gmail.com>
Nam V. Do <vannam12a7@gmail.com>
Nick Mykins <nmykins@digitalocean.com>
Expand Down Expand Up @@ -150,6 +152,7 @@ ronan <ronan.jezequel@gmail.com>
Ryan Shumate <Ryan.Shumate@garmin.com>
salmān aljammāz <s@aljmz.com>
Sam Lancia <sam@vaion.com>
Sean DuBois <duboisea@justin.tv>
Sean DuBois <duboisea@twitch.tv>
Sean DuBois <seaduboi@amazon.com>
Sean DuBois <sean@siobud.com>
Expand All @@ -162,6 +165,7 @@ Simone Gotti <simone.gotti@gmail.com>
Slugalisk <slugalisk@gmail.com>
soolaugust <soolaugust@gmail.com>
spaceCh1mp <drimboat@gmail.com>
stephanrotolante <stephanrotolante@gmail.com>
Suhas Gaddam <suhas.g.2011@gmail.com>
Suzuki Takeo <takeo@stko.info>
sylba2050 <masataka.hisasue@optim.co.jp>
Expand All @@ -177,6 +181,7 @@ Will Forcey <wsforc3y@gmail.com>
Will Watson <william.a.watson@gmail.com>
Woodrow Douglass <wdouglass@carnegierobotics.com>
xsbchen <xsbchen@qq.com>
Yoon SeungYong <simon.y@hpcnt.com>
Yuki Igarashi <me@bonprosoft.com>
yusuke <yusuke.m99@gmail.com>
Yutaka Takeda <yt0916@gmail.com>
Expand Down
4 changes: 2 additions & 2 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestE2E_Audio(t *testing.T) {
}
var result string
if err := page.RunScript(
"pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(answer)))",
"pc.setRemoteDescription(JSON.parse(answer))",
map[string]interface{}{"answer": string(answerBytes)},
&result,
); err != nil {
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestE2E_DataChannel(t *testing.T) {
}
var result string
if err := page.RunScript(
"pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(answer)))",
"pc.setRemoteDescription(JSON.parse(answer))",
map[string]interface{}{"answer": string(answerBytes)},
&result,
); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion examples/broadcast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ go get github.com/pion/webrtc/v3/examples/broadcast
```

### Open broadcast example page
[jsfiddle.net](https://jsfiddle.net/ypcsbnu3/) You should see two buttons `Publish a Broadcast` and `Join a Broadcast`
[jsfiddle.net](https://jsfiddle.net/us4h58jx/) You should see two buttons `Publish a Broadcast` and `Join a Broadcast`

### Run Broadcast
#### Linux/macOS
Expand Down
2 changes: 1 addition & 1 deletion examples/broadcast/jsfiddle/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ window.createSession = isPublisher => {
}

try {
pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd))))
pc.setRemoteDescription(JSON.parse(atob(sd)))
} catch (e) {
alert(e)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/data-channels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go get github.com/pion/webrtc/v3/examples/data-channels
```

### Open data-channels example page
[jsfiddle.net](https://jsfiddle.net/t3johb5g/2/)
[jsfiddle.net](https://jsfiddle.net/e41tgovp/)

### Run data-channels, with your browsers SessionDescription as stdin
In the jsfiddle the top textarea is your browser's session description, press `Copy browser SDP to clipboard` or copy the base64 string manually and:
Expand Down
2 changes: 1 addition & 1 deletion examples/data-channels/jsfiddle/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ window.startSession = () => {
}

try {
pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd))))
pc.setRemoteDescription(JSON.parse(atob(sd)))
} catch (e) {
alert(e)
}
Expand Down
8 changes: 4 additions & 4 deletions examples/ice-single-port/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
ice-single-port demonstrates Pion WebRTC's ability to serve many PeerConnections on a single port.

Pion WebRTC has no global state, so by default ports can't be shared between two PeerConnections.
Using the SettingEngine a developer can manually share state between many PeerConnections and allow
multiple to use the same port
Using the SettingEngine, a developer can manually share state between many PeerConnections to allow
multiple PeerConnections to use the same port.

## Instructions

Expand All @@ -21,8 +21,8 @@ cd webrtc/examples/ice-single-port
Execute `go run *.go`

### Open the Web UI
Open [http://localhost:8080](http://localhost:8080). This will automatically open 5 PeerConnections. This page will print
Open [http://localhost:8080](http://localhost:8080). This will automatically open 10 PeerConnections. This page will print
a Local/Remote line for each PeerConnection. Note that all 10 PeerConnections have different ports for their Local port.
However for the remote they all will be using port 8443.

Congrats, you have used Pion WebRTC! Now start building something cool
Congrats, you have used Pion WebRTC! Now start building something cool.
Loading

0 comments on commit b069de7

Please sign in to comment.