-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from LdDl/structure
Lock problem
- Loading branch information
Showing
12 changed files
with
305 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package videoserver | ||
|
||
import ( | ||
"github.com/deepch/vdk/av" | ||
"github.com/google/uuid" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
func (app *Application) startHlsCast(streamID uuid.UUID, stopCast chan StopSignal) error { | ||
app.Streams.Lock() | ||
defer app.Streams.Unlock() | ||
stream, ok := app.Streams.store[streamID] | ||
if !ok { | ||
return ErrStreamNotFound | ||
} | ||
go func(id uuid.UUID, hlsChanel chan av.Packet, stop chan StopSignal) { | ||
err := app.startHls(id, hlsChanel, stop) | ||
if err != nil { | ||
log.Error().Err(err).Str("scope", SCOPE_HLS).Str("event", EVENT_HLS_START_CAST).Str("stream_id", id.String()).Msg("Error on HLS cast start") | ||
} | ||
}(streamID, stream.hlsChanel, stopCast) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package videoserver | ||
|
||
import ( | ||
"github.com/deepch/vdk/av" | ||
"github.com/google/uuid" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
func (app *Application) startMP4Cast(archive *StreamArchiveWrapper, streamID uuid.UUID, stopCast chan StopSignal, errorSignal chan error, streamVerboseLevel VerboseLevel) error { | ||
if archive == nil { | ||
return ErrNullArchive | ||
} | ||
app.Streams.Lock() | ||
defer app.Streams.Unlock() | ||
stream, ok := app.Streams.store[streamID] | ||
if !ok { | ||
return ErrStreamNotFound | ||
} | ||
channel := stream.mp4Chanel | ||
go func(arch *StreamArchiveWrapper, id uuid.UUID, mp4Chanel chan av.Packet, stop chan StopSignal, verbose VerboseLevel) { | ||
err := app.startMP4(arch, id, mp4Chanel, stop, verbose) | ||
if err != nil { | ||
log.Error().Err(err).Str("scope", SCOPE_ARCHIVE).Str("event", EVENT_ARCHIVE_START_CAST).Str("stream_id", id.String()).Msg("Error on MP4 cast start") | ||
} | ||
errorSignal <- err | ||
}(archive, streamID, channel, stopCast, streamVerboseLevel) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.