Offset packet samples where possible (Ogg)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5c31f9d646
commit
b88107ad4c
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.gammaspectra.live/S.O.N.G/MeteorLight
|
|||
go 1.18
|
||||
|
||||
require (
|
||||
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220515173039-08d1c52b47c9
|
||||
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220515181630-297cacfbec13
|
||||
github.com/BurntSushi/toml v1.1.0
|
||||
github.com/dhowden/tag v0.0.0-20201120070457-d52dcb253c63
|
||||
github.com/enriquebris/goconcurrentqueue v0.6.3
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,5 @@
|
|||
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220515173039-08d1c52b47c9 h1:fydrHzrQYsgyBDykUWJcLP3k/eI7GW0/y/ypKriMvvU=
|
||||
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220515173039-08d1c52b47c9/go.mod h1:2o3ylTH2YMWIxV+eRwwkDlUZ18aNSPTf12ShaK13biI=
|
||||
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220515181630-297cacfbec13 h1:KFUzduZV2wCO9El1A1Ecu+L3Od3Q1M4KhI15tf7Is4E=
|
||||
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220515181630-297cacfbec13/go.mod h1:2o3ylTH2YMWIxV+eRwwkDlUZ18aNSPTf12ShaK13biI=
|
||||
git.gammaspectra.live/S.O.N.G/go-alac v0.0.0-20220421115623-d0b3bfe57e0f h1:CxN7zlk5FdAieyRKQSbwBGBsvQ2cDF8JVCODZpzcRkA=
|
||||
git.gammaspectra.live/S.O.N.G/go-alac v0.0.0-20220421115623-d0b3bfe57e0f/go.mod h1:f1+h7KOnuM9zcEQp7ri4UaVvgX4m1NFFIXgReIyjGMA=
|
||||
git.gammaspectra.live/S.O.N.G/go-ebur128 v0.0.0-20220418202343-73a167e76255 h1:BWRx2ZFyhp5+rsXhdDZtk5Gld+L44lxlN9ASqB9Oj0M=
|
||||
|
|
37
queue.go
37
queue.go
|
@ -695,6 +695,8 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
|||
return packetContent
|
||||
}
|
||||
|
||||
var streamStartOffset int64 = -1
|
||||
|
||||
packetWriteCallback = func(packet packetizer.Packet) error {
|
||||
if requestDone != nil {
|
||||
return requestDone
|
||||
|
@ -711,7 +713,22 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
|||
return nil
|
||||
}
|
||||
|
||||
p := packet.GetData()
|
||||
var p []byte
|
||||
if offsetable, ok := packet.(packetizer.OffsetablePacket); ok {
|
||||
if streamStartOffset <= -1 {
|
||||
if offsetable.KeepMode() != packetizer.Keep {
|
||||
streamStartOffset = offsetable.GetStartSampleNumber()
|
||||
p = offsetable.GetDataOffset(streamStartOffset)
|
||||
} else {
|
||||
p = packet.GetData()
|
||||
}
|
||||
} else {
|
||||
p = offsetable.GetDataOffset(streamStartOffset)
|
||||
}
|
||||
} else {
|
||||
p = packet.GetData()
|
||||
}
|
||||
|
||||
var data []byte
|
||||
for len(p) > 0 {
|
||||
l := icyInterval - icyCounter
|
||||
|
@ -735,6 +752,7 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
|||
return nil
|
||||
}
|
||||
} else {
|
||||
var streamStartOffset int64 = -1
|
||||
packetWriteCallback = func(packet packetizer.Packet) error {
|
||||
if requestDone != nil {
|
||||
return requestDone
|
||||
|
@ -748,7 +766,22 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
|||
log.Printf("failed to write data to client: %s\n", requestDone)
|
||||
return requestDone
|
||||
}
|
||||
writeChannel <- packet.GetData()
|
||||
|
||||
if offsetable, ok := packet.(packetizer.OffsetablePacket); ok {
|
||||
if streamStartOffset <= -1 {
|
||||
if offsetable.KeepMode() != packetizer.Keep {
|
||||
streamStartOffset = offsetable.GetStartSampleNumber()
|
||||
writeChannel <- offsetable.GetDataOffset(streamStartOffset)
|
||||
} else {
|
||||
writeChannel <- packet.GetData()
|
||||
}
|
||||
} else {
|
||||
writeChannel <- offsetable.GetDataOffset(streamStartOffset)
|
||||
}
|
||||
} else {
|
||||
writeChannel <- packet.GetData()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue