1
- //The RTMP server. This will put up a RTMP endpoint when starting up Swarm.
2
- //To integrate with LPMS means your code will become the source / destination of the media server.
3
- //This RTMP endpoint is mainly used for video upload. The expected url is rtmp://localhost:port/livepeer/stream
1
+ // The RTMP server. This will put up a RTMP endpoint when starting up Swarm.
2
+ // To integrate with LPMS means your code will become the source / destination of the media server.
3
+ // This RTMP endpoint is mainly used for video upload. The expected url is rtmp://localhost:port/livepeer/stream
4
4
package core
5
5
6
6
import (
@@ -67,7 +67,7 @@ func defaultLPMSOpts(opts *LPMSOpts) {
67
67
}
68
68
}
69
69
70
- //New creates a new LPMS server object. It really just brokers everything to the components.
70
+ // New creates a new LPMS server object. It really just brokers everything to the components.
71
71
func New (opts * LPMSOpts ) * LPMS {
72
72
defaultLPMSOpts (opts )
73
73
var rtmpServer * joy4rtmp.Server
@@ -83,7 +83,7 @@ func New(opts *LPMSOpts) *LPMS {
83
83
return & LPMS {vidPlayer : player , vidListener : listener , workDir : opts .WorkDir , rtmpAddr : opts .RtmpAddr , httpAddr : httpAddr }
84
84
}
85
85
86
- //Start starts the rtmp and http servers, and initializes ffmpeg
86
+ // Start starts the rtmp and http servers, and initializes ffmpeg
87
87
func (l * LPMS ) Start (ctx context.Context ) error {
88
88
ec := make (chan error , 1 )
89
89
ffmpeg .InitFFmpeg ()
@@ -114,21 +114,21 @@ func (l *LPMS) Start(ctx context.Context) error {
114
114
return nil
115
115
}
116
116
117
- //HandleRTMPPublish offload to the video listener. To understand how it works, look at videoListener.HandleRTMPPublish.
117
+ // HandleRTMPPublish offload to the video listener. To understand how it works, look at videoListener.HandleRTMPPublish.
118
118
func (l * LPMS ) HandleRTMPPublish (
119
- makeStreamID func (url * url.URL ) (strmID stream.AppData ),
119
+ makeStreamID func (url * url.URL ) (strmID stream.AppData , err error ),
120
120
gotStream func (url * url.URL , rtmpStrm stream.RTMPVideoStream ) (err error ),
121
121
endStream func (url * url.URL , rtmpStrm stream.RTMPVideoStream ) error ) {
122
122
123
123
l .vidListener .HandleRTMPPublish (makeStreamID , gotStream , endStream )
124
124
}
125
125
126
- //HandleRTMPPlay offload to the video player
126
+ // HandleRTMPPlay offload to the video player
127
127
func (l * LPMS ) HandleRTMPPlay (getStream func (url * url.URL ) (stream.RTMPVideoStream , error )) error {
128
128
return l .vidPlayer .HandleRTMPPlay (getStream )
129
129
}
130
130
131
- //HandleHLSPlay offload to the video player
131
+ // HandleHLSPlay offload to the video player
132
132
func (l * LPMS ) HandleHLSPlay (
133
133
getMasterPlaylist func (url * url.URL ) (* m3u8.MasterPlaylist , error ),
134
134
getMediaPlaylist func (url * url.URL ) (* m3u8.MediaPlaylist , error ),
@@ -137,7 +137,7 @@ func (l *LPMS) HandleHLSPlay(
137
137
l .vidPlayer .HandleHLSPlay (getMasterPlaylist , getMediaPlaylist , getSegment )
138
138
}
139
139
140
- //SegmentRTMPToHLS takes a rtmp stream and re-packages it into a HLS stream with the specified segmenter options
140
+ // SegmentRTMPToHLS takes a rtmp stream and re-packages it into a HLS stream with the specified segmenter options
141
141
func (l * LPMS ) SegmentRTMPToHLS (ctx context.Context , rs stream.RTMPVideoStream , hs stream.HLSVideoStream , segOptions segmenter.SegmenterOptions ) error {
142
142
// set localhost if necessary. Check more problematic addrs? [::] ?
143
143
rtmpAddr := l .rtmpAddr
0 commit comments