Fix godoc style comments (#356)
This commit is contained in:
committed by
GitHub
parent
8f921fbfde
commit
2e1f8d29b5
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/owncast/owncast/models"
|
||||
)
|
||||
|
||||
//Setup sets up the chat server
|
||||
// Setup sets up the chat server.
|
||||
func Setup(listener models.ChatListener) {
|
||||
setupPersistence()
|
||||
|
||||
@@ -32,7 +32,7 @@ func Setup(listener models.ChatListener) {
|
||||
}
|
||||
}
|
||||
|
||||
//Start starts the chat server
|
||||
// Start starts the chat server.
|
||||
func Start() error {
|
||||
if _server == nil {
|
||||
return errors.New("chat server is nil")
|
||||
@@ -53,7 +53,7 @@ func Start() error {
|
||||
return errors.New("chat server failed to start")
|
||||
}
|
||||
|
||||
//SendMessage sends a message to all
|
||||
// SendMessage sends a message to all.
|
||||
func SendMessage(message models.ChatMessage) {
|
||||
if _server == nil {
|
||||
return
|
||||
@@ -62,7 +62,7 @@ func SendMessage(message models.ChatMessage) {
|
||||
_server.SendToAll(message)
|
||||
}
|
||||
|
||||
//GetMessages gets all of the messages
|
||||
// GetMessages gets all of the messages.
|
||||
func GetMessages() []models.ChatMessage {
|
||||
if _server == nil {
|
||||
return []models.ChatMessage{}
|
||||
|
||||
@@ -44,7 +44,7 @@ const (
|
||||
PONG = "PONG"
|
||||
)
|
||||
|
||||
//NewClient creates a new chat client
|
||||
// NewClient creates a new chat client.
|
||||
func NewClient(ws *websocket.Conn) *Client {
|
||||
if ws == nil {
|
||||
log.Panicln("ws cannot be nil")
|
||||
@@ -63,7 +63,7 @@ func NewClient(ws *websocket.Conn) *Client {
|
||||
return &Client{time.Now(), 0, userAgent, ipAddress, nil, clientID, nil, socketID, ws, ch, pingch, usernameChangeChannel, doneCh}
|
||||
}
|
||||
|
||||
//GetConnection gets the connection for the client
|
||||
// GetConnection gets the connection for the client.
|
||||
func (c *Client) GetConnection() *websocket.Conn {
|
||||
return c.ws
|
||||
}
|
||||
@@ -77,18 +77,18 @@ func (c *Client) Write(msg models.ChatMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
//Done marks the client as done
|
||||
// Done marks the client as done.
|
||||
func (c *Client) Done() {
|
||||
c.doneCh <- true
|
||||
}
|
||||
|
||||
// Listen Write and Read request via chanel
|
||||
// Listen Write and Read request via channel.
|
||||
func (c *Client) Listen() {
|
||||
go c.listenWrite()
|
||||
c.listenRead()
|
||||
}
|
||||
|
||||
// Listen write request via chanel
|
||||
// Listen write request via channel.
|
||||
func (c *Client) listenWrite() {
|
||||
for {
|
||||
select {
|
||||
@@ -110,7 +110,7 @@ func (c *Client) listenWrite() {
|
||||
}
|
||||
}
|
||||
|
||||
// Listen read request via chanel
|
||||
// Listen read request via channel.
|
||||
func (c *Client) listenRead() {
|
||||
for {
|
||||
select {
|
||||
|
||||
@@ -16,7 +16,7 @@ var (
|
||||
_server *server
|
||||
)
|
||||
|
||||
//Server represents the server which handles the chat
|
||||
// Server represents the server which handles the chat.
|
||||
type server struct {
|
||||
Clients map[string]*Client
|
||||
|
||||
@@ -31,27 +31,27 @@ type server struct {
|
||||
errCh chan error
|
||||
}
|
||||
|
||||
//Add adds a client to the server
|
||||
// Add adds a client to the server.
|
||||
func (s *server) add(c *Client) {
|
||||
s.addCh <- c
|
||||
}
|
||||
|
||||
//Remove removes a client from the server
|
||||
// Remove removes a client from the server.
|
||||
func (s *server) remove(c *Client) {
|
||||
s.delCh <- c
|
||||
}
|
||||
|
||||
//SendToAll sends a message to all of the connected clients
|
||||
// SendToAll sends a message to all of the connected clients.
|
||||
func (s *server) SendToAll(msg models.ChatMessage) {
|
||||
s.sendAllCh <- msg
|
||||
}
|
||||
|
||||
//Done marks the server as done
|
||||
// Done marks the server as done.
|
||||
func (s *server) done() {
|
||||
s.doneCh <- true
|
||||
}
|
||||
|
||||
//Err handles an error
|
||||
// Err handles an error.
|
||||
func (s *server) err(err error) {
|
||||
s.errCh <- err
|
||||
}
|
||||
|
||||
@@ -7,24 +7,24 @@ import (
|
||||
"github.com/owncast/owncast/models"
|
||||
)
|
||||
|
||||
//ChatListenerImpl the implementation of the chat client
|
||||
// ChatListenerImpl the implementation of the chat client.
|
||||
type ChatListenerImpl struct{}
|
||||
|
||||
//ClientAdded is for when a client is added the system
|
||||
// ClientAdded is for when a client is added the system.
|
||||
func (cl ChatListenerImpl) ClientAdded(client models.Client) {
|
||||
SetClientActive(client)
|
||||
}
|
||||
|
||||
//ClientRemoved is for when a client disconnects/is removed
|
||||
// ClientRemoved is for when a client disconnects/is removed.
|
||||
func (cl ChatListenerImpl) ClientRemoved(clientID string) {
|
||||
RemoveClient(clientID)
|
||||
}
|
||||
|
||||
//MessageSent is for when a message is sent
|
||||
// MessageSent is for when a message is sent.
|
||||
func (cl ChatListenerImpl) MessageSent(message models.ChatMessage) {
|
||||
}
|
||||
|
||||
//SendMessageToChat sends a message to the chat server
|
||||
// SendMessageToChat sends a message to the chat server.
|
||||
func SendMessageToChat(message models.ChatMessage) error {
|
||||
if !message.Valid() {
|
||||
return errors.New("invalid chat message; id, author, and body are required")
|
||||
@@ -35,7 +35,7 @@ func SendMessageToChat(message models.ChatMessage) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//GetAllChatMessages gets all of the chat messages
|
||||
// GetAllChatMessages gets all of the chat messages.
|
||||
func GetAllChatMessages() []models.ChatMessage {
|
||||
return chat.GetMessages()
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ var (
|
||||
var handler ffmpeg.HLSHandler
|
||||
var fileWriter = ffmpeg.FileWriterReceiverService{}
|
||||
|
||||
//Start starts up the core processing
|
||||
// Start starts up the core processing.
|
||||
func Start() error {
|
||||
resetDirectories()
|
||||
|
||||
|
||||
@@ -15,19 +15,19 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// FileWriterReceiverServiceCallback are to be fired when transcoder responses are written to disk
|
||||
// FileWriterReceiverServiceCallback are to be fired when transcoder responses are written to disk.
|
||||
type FileWriterReceiverServiceCallback interface {
|
||||
SegmentWritten(localFilePath string)
|
||||
VariantPlaylistWritten(localFilePath string)
|
||||
MasterPlaylistWritten(localFilePath string)
|
||||
}
|
||||
|
||||
// FileWriterReceiverService accepts transcoder responses via HTTP and fires the callbacks
|
||||
// FileWriterReceiverService accepts transcoder responses via HTTP and fires the callbacks.
|
||||
type FileWriterReceiverService struct {
|
||||
callbacks FileWriterReceiverServiceCallback
|
||||
}
|
||||
|
||||
// SetupFileWriterReceiverService will start listening for transcoder responses
|
||||
// SetupFileWriterReceiverService will start listening for transcoder responses.
|
||||
func (s *FileWriterReceiverService) SetupFileWriterReceiverService(callbacks FileWriterReceiverServiceCallback) {
|
||||
s.callbacks = callbacks
|
||||
|
||||
|
||||
@@ -4,22 +4,22 @@ import (
|
||||
"github.com/owncast/owncast/models"
|
||||
)
|
||||
|
||||
// HLSHandler gets told about available HLS playlists and segments
|
||||
// HLSHandler gets told about available HLS playlists and segments.
|
||||
type HLSHandler struct {
|
||||
Storage models.StorageProvider
|
||||
}
|
||||
|
||||
// SegmentWritten is fired when a HLS segment is written to disk
|
||||
// SegmentWritten is fired when a HLS segment is written to disk.
|
||||
func (h *HLSHandler) SegmentWritten(localFilePath string) {
|
||||
h.Storage.SegmentWritten(localFilePath)
|
||||
}
|
||||
|
||||
// VariantPlaylistWritten is fired when a HLS variant playlist is written to disk
|
||||
// VariantPlaylistWritten is fired when a HLS variant playlist is written to disk.
|
||||
func (h *HLSHandler) VariantPlaylistWritten(localFilePath string) {
|
||||
h.Storage.VariantPlaylistWritten(localFilePath)
|
||||
}
|
||||
|
||||
// MasterPlaylistWritten is fired when a HLS master playlist is written to disk
|
||||
// MasterPlaylistWritten is fired when a HLS master playlist is written to disk.
|
||||
func (h *HLSHandler) MasterPlaylistWritten(localFilePath string) {
|
||||
h.Storage.MasterPlaylistWritten(localFilePath)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func StopThumbnailGenerator() {
|
||||
}
|
||||
}
|
||||
|
||||
//StartThumbnailGenerator starts generating thumbnails
|
||||
// StartThumbnailGenerator starts generating thumbnails.
|
||||
func StartThumbnailGenerator(chunkPath string, variantIndex int) {
|
||||
// Every 20 seconds create a thumbnail from the most
|
||||
// recent video segment.
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
var _commandExec *exec.Cmd
|
||||
|
||||
// Transcoder is a single instance of a video transcoder
|
||||
// Transcoder is a single instance of a video transcoder.
|
||||
type Transcoder struct {
|
||||
input string
|
||||
segmentOutputPath string
|
||||
@@ -30,7 +30,7 @@ type Transcoder struct {
|
||||
TranscoderCompleted func(error)
|
||||
}
|
||||
|
||||
// HLSVariant is a combination of settings that results in a single HLS stream
|
||||
// HLSVariant is a combination of settings that results in a single HLS stream.
|
||||
type HLSVariant struct {
|
||||
index int
|
||||
|
||||
@@ -45,13 +45,13 @@ type HLSVariant struct {
|
||||
encoderPreset string // A collection of automatic settings for the encoder. https://trac.ffmpeg.org/wiki/Encode/H.264#crf
|
||||
}
|
||||
|
||||
// VideoSize is the scaled size of the video output
|
||||
// VideoSize is the scaled size of the video output.
|
||||
type VideoSize struct {
|
||||
Width int
|
||||
Height int
|
||||
}
|
||||
|
||||
// getString returns a WxH formatted getString for scaling video output
|
||||
// getString returns a WxH formatted getString for scaling video output.
|
||||
func (v *VideoSize) getString() string {
|
||||
widthString := strconv.Itoa(v.Width)
|
||||
heightString := strconv.Itoa(v.Height)
|
||||
@@ -197,7 +197,7 @@ func getVariantFromConfigQuality(quality config.StreamQuality, index int) HLSVar
|
||||
return variant
|
||||
}
|
||||
|
||||
// NewTranscoder will return a new Transcoder, populated by the config
|
||||
// NewTranscoder will return a new Transcoder, populated by the config.
|
||||
func NewTranscoder() *Transcoder {
|
||||
transcoder := new(Transcoder)
|
||||
transcoder.ffmpegPath = config.Config.GetFFMpegPath()
|
||||
@@ -248,7 +248,7 @@ func (v *HLSVariant) getVariantString(t *Transcoder) string {
|
||||
return strings.Join(variantEncoderCommands, " ")
|
||||
}
|
||||
|
||||
// Get the command flags for the variants
|
||||
// Get the command flags for the variants.
|
||||
func (t *Transcoder) getVariantsString() string {
|
||||
var variantsCommandFlags = ""
|
||||
var variantsStreamMaps = " -var_stream_map \""
|
||||
@@ -267,12 +267,12 @@ func (t *Transcoder) getVariantsString() string {
|
||||
// If we'd like to keep the aspect ratio, we need to specify only one component, either width or height.
|
||||
// Some codecs require the size of width and height to be a multiple of n. You can achieve this by setting the width or height to -n.
|
||||
|
||||
// SetVideoScalingWidth will set the scaled video width of this variant
|
||||
// SetVideoScalingWidth will set the scaled video width of this variant.
|
||||
func (v *HLSVariant) SetVideoScalingWidth(width int) {
|
||||
v.videoSize.Width = width
|
||||
}
|
||||
|
||||
// SetVideoScalingHeight will set the scaled video height of this variant
|
||||
// SetVideoScalingHeight will set the scaled video height of this variant.
|
||||
func (v *HLSVariant) SetVideoScalingHeight(height int) {
|
||||
v.videoSize.Height = height
|
||||
}
|
||||
@@ -284,7 +284,7 @@ func (v *HLSVariant) getScalingString() string {
|
||||
|
||||
// Video Quality
|
||||
|
||||
// SetVideoBitrate will set the output bitrate of this variant's video
|
||||
// SetVideoBitrate will set the output bitrate of this variant's video.
|
||||
func (v *HLSVariant) SetVideoBitrate(bitrate int) {
|
||||
v.videoBitrate = bitrate
|
||||
}
|
||||
@@ -321,19 +321,19 @@ func (v *HLSVariant) getVideoQualityString(t *Transcoder) string {
|
||||
return strings.Join(cmd, " ")
|
||||
}
|
||||
|
||||
// SetVideoFramerate will set the output framerate of this variant's video
|
||||
// SetVideoFramerate will set the output framerate of this variant's video.
|
||||
func (v *HLSVariant) SetVideoFramerate(framerate int) {
|
||||
v.framerate = framerate
|
||||
}
|
||||
|
||||
// SetEncoderPreset will set the video encoder preset of this variant
|
||||
// SetEncoderPreset will set the video encoder preset of this variant.
|
||||
func (v *HLSVariant) SetEncoderPreset(preset string) {
|
||||
v.encoderPreset = preset
|
||||
}
|
||||
|
||||
// Audio Quality
|
||||
|
||||
// SetAudioBitrate will set the output framerate of this variant's audio
|
||||
// SetAudioBitrate will set the output framerate of this variant's audio.
|
||||
func (v *HLSVariant) SetAudioBitrate(bitrate string) {
|
||||
v.audioBitrate = bitrate
|
||||
}
|
||||
@@ -348,38 +348,38 @@ func (v *HLSVariant) getAudioQualityString() string {
|
||||
return fmt.Sprintf("-map a:0 -c:a:%d %s -b:a:%d %s", v.index, encoderCodec, v.index, v.audioBitrate)
|
||||
}
|
||||
|
||||
// AddVariant adds a new HLS variant to include in the output
|
||||
// AddVariant adds a new HLS variant to include in the output.
|
||||
func (t *Transcoder) AddVariant(variant HLSVariant) {
|
||||
variant.index = len(t.variants)
|
||||
t.variants = append(t.variants, variant)
|
||||
}
|
||||
|
||||
// SetInput sets the input stream on the filesystem
|
||||
// SetInput sets the input stream on the filesystem.
|
||||
func (t *Transcoder) SetInput(input string) {
|
||||
t.input = input
|
||||
}
|
||||
|
||||
// SetOutputPath sets the root directory that should include playlists and video segments
|
||||
// SetOutputPath sets the root directory that should include playlists and video segments.
|
||||
func (t *Transcoder) SetOutputPath(output string) {
|
||||
t.segmentOutputPath = output
|
||||
}
|
||||
|
||||
// SetHLSPlaylistLength will set the max number of items in a HLS variant's playlist
|
||||
// SetHLSPlaylistLength will set the max number of items in a HLS variant's playlist.
|
||||
func (t *Transcoder) SetHLSPlaylistLength(length int) {
|
||||
t.hlsPlaylistLength = length
|
||||
}
|
||||
|
||||
// SetSegmentLength Specifies the number of seconds each segment should be
|
||||
// SetSegmentLength Specifies the number of seconds each segment should be.
|
||||
func (t *Transcoder) SetSegmentLength(seconds int) {
|
||||
t.segmentLengthSeconds = seconds
|
||||
}
|
||||
|
||||
// SetAppendToStream enables appending to the HLS stream instead of overwriting
|
||||
// SetAppendToStream enables appending to the HLS stream instead of overwriting.
|
||||
func (t *Transcoder) SetAppendToStream(append bool) {
|
||||
t.appendToStream = append
|
||||
}
|
||||
|
||||
// SetIdentifer enables appending a unique identifier to segment file name
|
||||
// SetIdentifer enables appending a unique identifier to segment file name.
|
||||
func (t *Transcoder) SetIdentifier(output string) {
|
||||
t.segmentIdentifier = output
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package playlist
|
||||
|
||||
import "os"
|
||||
|
||||
//WritePlaylist writes the playlist to disk
|
||||
// WritePlaylist writes the playlist to disk.
|
||||
func WritePlaylist(data string, filePath string) error {
|
||||
f, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
|
||||
@@ -30,7 +30,7 @@ var _rtmpConnection net.Conn
|
||||
var _setStreamAsConnected func()
|
||||
var _setBroadcaster func(models.Broadcaster)
|
||||
|
||||
//Start starts the rtmp service, listening on port 1935
|
||||
// Start starts the rtmp service, listening on port 1935.
|
||||
func Start(setStreamAsConnected func(), setBroadcaster func(models.Broadcaster)) {
|
||||
_setStreamAsConnected = setStreamAsConnected
|
||||
_setBroadcaster = setBroadcaster
|
||||
|
||||
@@ -46,7 +46,7 @@ func setupStats() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//IsStreamConnected checks if the stream is connected or not
|
||||
// IsStreamConnected checks if the stream is connected or not.
|
||||
func IsStreamConnected() bool {
|
||||
if !_stats.StreamConnected {
|
||||
return false
|
||||
@@ -62,7 +62,7 @@ func IsStreamConnected() bool {
|
||||
return _stats.StreamConnected
|
||||
}
|
||||
|
||||
//SetClientActive sets a client as active and connected
|
||||
// SetClientActive sets a client as active and connected.
|
||||
func SetClientActive(client models.Client) {
|
||||
l.Lock()
|
||||
// If this clientID already exists then update it.
|
||||
@@ -88,7 +88,7 @@ func SetClientActive(client models.Client) {
|
||||
}
|
||||
}
|
||||
|
||||
//RemoveClient removes a client from the active clients record
|
||||
// RemoveClient removes a client from the active clients record.
|
||||
func RemoveClient(clientID string) {
|
||||
log.Trace("Removing the client:", clientID)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/owncast/owncast/models"
|
||||
)
|
||||
|
||||
//GetStatus gets the status of the system
|
||||
// GetStatus gets the status of the system.
|
||||
func GetStatus() models.Status {
|
||||
if _stats == nil {
|
||||
return models.Status{}
|
||||
@@ -22,7 +22,7 @@ func GetStatus() models.Status {
|
||||
}
|
||||
}
|
||||
|
||||
// setBroadcaster will store the current inbound broadcasting details
|
||||
// setBroadcaster will store the current inbound broadcasting details.
|
||||
func setBroadcaster(broadcaster models.Broadcaster) {
|
||||
_broadcaster = &broadcaster
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ type LocalStorage struct {
|
||||
// Cleanup old public HLS content every N min from the webroot.
|
||||
var _onlineCleanupTicker *time.Ticker
|
||||
|
||||
// Setup configures this storage provider
|
||||
// Setup configures this storage provider.
|
||||
func (s *LocalStorage) Setup() error {
|
||||
// NOTE: This cleanup timer will have to be disabled to support recordings in the future
|
||||
// as all HLS segments have to be publicly available on disk to keep a recording of them.
|
||||
@@ -33,12 +33,12 @@ func (s *LocalStorage) Setup() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SegmentWritten is called when a single segment of video is written
|
||||
// SegmentWritten is called when a single segment of video is written.
|
||||
func (s *LocalStorage) SegmentWritten(localFilePath string) {
|
||||
s.Save(localFilePath, 0)
|
||||
}
|
||||
|
||||
// VariantPlaylistWritten is called when a variant hls playlist is written
|
||||
// VariantPlaylistWritten is called when a variant hls playlist is written.
|
||||
func (s *LocalStorage) VariantPlaylistWritten(localFilePath string) {
|
||||
_, err := s.Save(localFilePath, 0)
|
||||
if err != nil {
|
||||
@@ -47,12 +47,12 @@ func (s *LocalStorage) VariantPlaylistWritten(localFilePath string) {
|
||||
}
|
||||
}
|
||||
|
||||
// MasterPlaylistWritten is called when the master hls playlist is written
|
||||
// MasterPlaylistWritten is called when the master hls playlist is written.
|
||||
func (s *LocalStorage) MasterPlaylistWritten(localFilePath string) {
|
||||
s.Save(localFilePath, 0)
|
||||
}
|
||||
|
||||
// Save will save a local filepath using the storage provider
|
||||
// Save will save a local filepath using the storage provider.
|
||||
func (s *LocalStorage) Save(filePath string, retryCount int) (string, error) {
|
||||
newPath := ""
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
// then keep a reference to it here.
|
||||
var _queuedPlaylistUpdates = make(map[string]string, 0)
|
||||
|
||||
//S3Storage is the s3 implementation of the ChunkStorageProvider
|
||||
// S3Storage is the s3 implementation of the ChunkStorageProvider.
|
||||
type S3Storage struct {
|
||||
sess *session.Session
|
||||
host string
|
||||
@@ -40,7 +40,7 @@ type S3Storage struct {
|
||||
|
||||
var _uploader *s3manager.Uploader
|
||||
|
||||
//Setup sets up the s3 storage for saving the video to s3
|
||||
// Setup sets up the s3 storage for saving the video to s3.
|
||||
func (s *S3Storage) Setup() error {
|
||||
log.Trace("Setting up S3 for external storage of video...")
|
||||
|
||||
@@ -65,7 +65,7 @@ func (s *S3Storage) Setup() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SegmentWritten is called when a single segment of video is written
|
||||
// SegmentWritten is called when a single segment of video is written.
|
||||
func (s *S3Storage) SegmentWritten(localFilePath string) {
|
||||
index := utils.GetIndexFromFilePath(localFilePath)
|
||||
performanceMonitorKey := "s3upload-" + index
|
||||
@@ -100,7 +100,7 @@ func (s *S3Storage) SegmentWritten(localFilePath string) {
|
||||
}
|
||||
}
|
||||
|
||||
// VariantPlaylistWritten is called when a variant hls playlist is written
|
||||
// VariantPlaylistWritten is called when a variant hls playlist is written.
|
||||
func (s *S3Storage) VariantPlaylistWritten(localFilePath string) {
|
||||
// We are uploading the variant playlist after uploading the segment
|
||||
// to make sure we're not referring to files in a playlist that don't
|
||||
@@ -115,13 +115,13 @@ func (s *S3Storage) VariantPlaylistWritten(localFilePath string) {
|
||||
}
|
||||
}
|
||||
|
||||
// MasterPlaylistWritten is called when the master hls playlist is written
|
||||
// MasterPlaylistWritten is called when the master hls playlist is written.
|
||||
func (s *S3Storage) MasterPlaylistWritten(localFilePath string) {
|
||||
// Rewrite the playlist to use absolute remote S3 URLs
|
||||
s.rewriteRemotePlaylist(localFilePath)
|
||||
}
|
||||
|
||||
// Save saves the file to the s3 bucket
|
||||
// Save saves the file to the s3 bucket.
|
||||
func (s *S3Storage) Save(filePath string, retryCount int) (string, error) {
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
|
||||
@@ -23,7 +23,7 @@ var _offlineCleanupTimer *time.Timer
|
||||
// While a stream takes place cleanup old HLS content every N min.
|
||||
var _onlineCleanupTicker *time.Ticker
|
||||
|
||||
//setStreamAsConnected sets the stream as connected
|
||||
// setStreamAsConnected sets the stream as connected.
|
||||
func setStreamAsConnected() {
|
||||
_stats.StreamConnected = true
|
||||
_stats.LastConnectTime = utils.NullTime{time.Now(), true}
|
||||
@@ -53,7 +53,7 @@ func setStreamAsConnected() {
|
||||
ffmpeg.StartThumbnailGenerator(segmentPath, config.Config.VideoSettings.HighestQualityStreamIndex)
|
||||
}
|
||||
|
||||
//SetStreamAsDisconnected sets the stream as disconnected.
|
||||
// SetStreamAsDisconnected sets the stream as disconnected.
|
||||
func SetStreamAsDisconnected() {
|
||||
_stats.StreamConnected = false
|
||||
_stats.LastDisconnectTime = utils.NullTime{time.Now(), true}
|
||||
@@ -125,7 +125,7 @@ func SetStreamAsDisconnected() {
|
||||
stopOnlineCleanupTimer()
|
||||
}
|
||||
|
||||
// StartOfflineCleanupTimer will fire a cleanup after n minutes being disconnected
|
||||
// StartOfflineCleanupTimer will fire a cleanup after n minutes being disconnected.
|
||||
func StartOfflineCleanupTimer() {
|
||||
_offlineCleanupTimer = time.NewTimer(5 * time.Minute)
|
||||
go func() {
|
||||
@@ -141,7 +141,7 @@ func StartOfflineCleanupTimer() {
|
||||
}()
|
||||
}
|
||||
|
||||
// StopOfflineCleanupTimer will stop the previous cleanup timer
|
||||
// StopOfflineCleanupTimer will stop the previous cleanup timer.
|
||||
func StopOfflineCleanupTimer() {
|
||||
if _offlineCleanupTimer != nil {
|
||||
_offlineCleanupTimer.Stop()
|
||||
|
||||
Reference in New Issue
Block a user