mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
support reading UDP/MPEG-TS streams (#1490)
* support reading UDP/MPEG-TS streams * support reading H265 and Opus tracks inside UDP/MPEG-TS streams * improve timestamp precision of Opus packets
This commit is contained in:
parent
7a4928643d
commit
fb1c16d606
8 changed files with 437 additions and 39 deletions
|
|
@ -61,14 +61,14 @@ func (s *hlsSource) run(ctx context.Context, cnf *conf.PathConf, reloadConf chan
|
|||
Formats: []format.Format{track},
|
||||
}
|
||||
medias = append(medias, medi)
|
||||
ctrack := track
|
||||
cformat := track
|
||||
|
||||
switch track.(type) {
|
||||
case *format.H264:
|
||||
medi.Type = media.TypeVideo
|
||||
|
||||
c.OnData(track, func(pts time.Duration, unit interface{}) {
|
||||
err := stream.writeData(medi, ctrack, &formatprocessor.UnitH264{
|
||||
err := stream.writeData(medi, cformat, &formatprocessor.UnitH264{
|
||||
PTS: pts,
|
||||
AU: unit.([][]byte),
|
||||
NTP: time.Now(),
|
||||
|
|
@ -82,7 +82,7 @@ func (s *hlsSource) run(ctx context.Context, cnf *conf.PathConf, reloadConf chan
|
|||
medi.Type = media.TypeVideo
|
||||
|
||||
c.OnData(track, func(pts time.Duration, unit interface{}) {
|
||||
err := stream.writeData(medi, ctrack, &formatprocessor.UnitH265{
|
||||
err := stream.writeData(medi, cformat, &formatprocessor.UnitH265{
|
||||
PTS: pts,
|
||||
AU: unit.([][]byte),
|
||||
NTP: time.Now(),
|
||||
|
|
@ -96,7 +96,7 @@ func (s *hlsSource) run(ctx context.Context, cnf *conf.PathConf, reloadConf chan
|
|||
medi.Type = media.TypeAudio
|
||||
|
||||
c.OnData(track, func(pts time.Duration, unit interface{}) {
|
||||
err := stream.writeData(medi, ctrack, &formatprocessor.UnitMPEG4Audio{
|
||||
err := stream.writeData(medi, cformat, &formatprocessor.UnitMPEG4Audio{
|
||||
PTS: pts,
|
||||
AUs: [][]byte{unit.([]byte)},
|
||||
NTP: time.Now(),
|
||||
|
|
@ -110,7 +110,7 @@ func (s *hlsSource) run(ctx context.Context, cnf *conf.PathConf, reloadConf chan
|
|||
medi.Type = media.TypeAudio
|
||||
|
||||
c.OnData(track, func(pts time.Duration, unit interface{}) {
|
||||
err := stream.writeData(medi, ctrack, &formatprocessor.UnitOpus{
|
||||
err := stream.writeData(medi, cformat, &formatprocessor.UnitOpus{
|
||||
PTS: pts,
|
||||
Frame: unit.([]byte),
|
||||
NTP: time.Now(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue