Skip to content

Commit

Permalink
Delete deadcode in pion-to-pion/answer
Browse files Browse the repository at this point in the history
Was accidentally copied, never needed
  • Loading branch information
Sean-Der committed Jul 18, 2024
1 parent 287d106 commit ce37669
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions examples/pion-to-pion/answer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
package main

import (
"bufio"
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"net/http"
"os"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -191,45 +187,3 @@ func main() { // nolint:gocognit
// nolint: gosec
panic(http.ListenAndServe(*answerAddr, nil))
}

// Read from stdin until we get a newline
func readUntilNewline() (in string) {
var err error

r := bufio.NewReader(os.Stdin)
for {
in, err = r.ReadString('\n')
if err != nil && !errors.Is(err, io.EOF) {
panic(err)
}

if in = strings.TrimSpace(in); len(in) > 0 {
break
}
}

fmt.Println("")
return
}

// JSON encode + base64 a SessionDescription
func encode(obj *webrtc.SessionDescription) string {
b, err := json.Marshal(obj)
if err != nil {
panic(err)
}

return base64.StdEncoding.EncodeToString(b)
}

// Decode a base64 and unmarshal JSON into a SessionDescription
func decode(in string, obj *webrtc.SessionDescription) {
b, err := base64.StdEncoding.DecodeString(in)
if err != nil {
panic(err)
}

if err = json.Unmarshal(b, obj); err != nil {
panic(err)
}
}

0 comments on commit ce37669

Please sign in to comment.