Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a transcoding bug that occurred when remote transcoder was removed #2747

Merged
merged 9 commits into from
Feb 14, 2023
2 changes: 1 addition & 1 deletion CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#### Transcoder

### Bug Fixes 🐞
- #2747 Fixed a transcoding bug that occurred when remote transcoder was removed

#### CLI

#### General
- \#2713 Add support for keyfiles with -ethKeystorePath, update flag descriptions, flagset output to stdout

#### Broadcaster
- \#2709 Add logging for high keyframe interval, reduce log level for discovery loop
eliteprox marked this conversation as resolved.
Show resolved Hide resolved
- \#2684 Fix transcode success rate metric

#### Orchestrator
Expand Down
19 changes: 4 additions & 15 deletions core/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,25 +913,14 @@ func (rtm *RemoteTranscoderManager) Manage(stream net.Transcoder_RegisterTransco

func removeFromRemoteTranscoders(rt *RemoteTranscoder, remoteTranscoders []*RemoteTranscoder) []*RemoteTranscoder {
if len(remoteTranscoders) == 0 {
// No transocerds to remove, return
// No transcoders to remove, return
return remoteTranscoders
}

lastIndex := len(remoteTranscoders) - 1
last := remoteTranscoders[lastIndex]
if rt == last {
return remoteTranscoders[:lastIndex]
}

newRemoteTs := make([]*RemoteTranscoder, 0)
for i, t := range remoteTranscoders {
if t == rt {
if i == 0 {
return remoteTranscoders[1:]
}
newRemoteTs = remoteTranscoders[:i]
newRemoteTs = append(newRemoteTs, remoteTranscoders[i+1:]...)
break
for _, t := range remoteTranscoders {
if t != rt {
newRemoteTs = append(newRemoteTs, t)
}
}
return newRemoteTs
Expand Down