File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
internal/staticsources/srt Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 2
2
package srt
3
3
4
4
import (
5
+ "fmt"
6
+ "io"
7
+ "log"
5
8
"time"
6
9
7
10
"github.com/bluenviron/gortsplib/v4/pkg/description"
@@ -16,6 +19,25 @@ import (
16
19
"github.com/bluenviron/mediamtx/internal/stream"
17
20
)
18
21
22
+ type loggedConn struct {
23
+ R io.Reader
24
+ }
25
+
26
+ func (c * loggedConn ) Read (p []byte ) (int , error ) {
27
+ n , err := c .R .Read (p )
28
+ log .Println ("incoming:" )
29
+
30
+ for i , x := range p [:n ] {
31
+ fmt .Printf ("0x%.2x, " , x )
32
+ if (i + 1 )% 8 == 0 {
33
+ fmt .Println ("" )
34
+ }
35
+ }
36
+ fmt .Println ("" )
37
+
38
+ return n , err
39
+ }
40
+
19
41
// Source is a SRT static source.
20
42
type Source struct {
21
43
ReadTimeout conf.Duration
@@ -70,7 +92,8 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
70
92
71
93
func (s * Source ) runReader (sconn srt.Conn ) error {
72
94
sconn .SetReadDeadline (time .Now ().Add (time .Duration (s .ReadTimeout )))
73
- r := & mcmpegts.Reader {R : mcmpegts .NewBufferedReader (sconn )}
95
+ lconn := & loggedConn {R : sconn }
96
+ r := & mcmpegts.Reader {R : mcmpegts .NewBufferedReader (lconn )}
74
97
err := r .Initialize ()
75
98
if err != nil {
76
99
return err
You can’t perform that action at this time.
0 commit comments