forked from AlexxIT/go2rtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bitrate to webrtc/mse/mp4 consumer info (#5)
- Loading branch information
Showing
12 changed files
with
80 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ go2rtc.yaml | |
go2rtc.json | ||
|
||
0_test.go | ||
|
||
.goreload |
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,2 @@ | ||
dev: | ||
goreload . |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package custom | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
func StartBitrateWorker(send, bitrate *int, stop chan struct{}) { | ||
ticker := time.NewTicker(time.Second) | ||
defer ticker.Stop() | ||
|
||
prevSendBytes := *send | ||
for { | ||
select { | ||
case <-ticker.C: | ||
*bitrate = *send - prevSendBytes | ||
prevSendBytes = *send | ||
case <-stop: | ||
return | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package isapi | ||
|
||
import "github.com/AlexxIT/go2rtc/pkg/custom" | ||
|
||
func (c *Client) startBitrateWorker() { | ||
c.stopBitrateWorker = make(chan struct{}) | ||
go custom.StartBitrateWorker(&c.send, &c.bitrate, c.stopBitrateWorker) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package mp4 | ||
|
||
import "github.com/AlexxIT/go2rtc/pkg/custom" | ||
|
||
func (c *Consumer) startBitrateWorker() { | ||
c.stopBitrateWorker = make(chan struct{}) | ||
go custom.StartBitrateWorker(&c.SuperConsumer.Send, &c.SuperConsumer.Bitrate, c.stopBitrateWorker) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package webrtc | ||
|
||
import ( | ||
"github.com/AlexxIT/go2rtc/pkg/custom" | ||
) | ||
|
||
func (c *Conn) startBitrateWorker() { | ||
c.stopBitrateWorker = make(chan struct{}) | ||
go custom.StartBitrateWorker(&c.send, &c.bitrate, c.stopBitrateWorker) | ||
} |