Skip to content

Commit

Permalink
Fixed a transcoding bug that occurred when remote transcoder was remo…
Browse files Browse the repository at this point in the history
…ved (#2747)

* Fixed a transcoding bug that occured when remote transcoder was removed

---------

Co-authored-by: Elite Encoder <john@eliteencoder.net>
  • Loading branch information
eliteprox and eliteprox committed Feb 14, 2023
1 parent 0ec1972 commit f6d88fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
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
- \#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

0 comments on commit f6d88fd

Please sign in to comment.