Rewrite Receiver/Sender classes

This commit is contained in:
Alex X
2024-06-05 20:01:47 +03:00
parent e0b1a50356
commit 31e4ba2722
4 changed files with 327 additions and 167 deletions
+5
View File
@@ -2,6 +2,7 @@ package core
import (
"encoding/base64"
"encoding/json"
"fmt"
"strconv"
"strings"
@@ -18,6 +19,10 @@ type Codec struct {
PayloadType uint8
}
func (c *Codec) MarshalJSON() ([]byte, error) {
return json.Marshal(c.String())
}
func (c *Codec) String() string {
s := fmt.Sprintf("%d %s", c.PayloadType, c.Name)
if c.ClockRate != 0 && c.ClockRate != 90000 {