generation-aware playback statuses
This commit is contained in:
@@ -88,10 +88,11 @@ func TestNewSessionControllerStoresSyncPredicate(t *testing.T) {
|
||||
}
|
||||
|
||||
type controllerEvent struct {
|
||||
unit Unit
|
||||
action string
|
||||
feed FeedConfig
|
||||
pair SyncPairConfig
|
||||
unit Unit
|
||||
action string
|
||||
generation uint64
|
||||
feed FeedConfig
|
||||
pair SyncPairConfig
|
||||
}
|
||||
|
||||
type recordingVideoSlot struct{ events chan<- controllerEvent }
|
||||
@@ -101,7 +102,10 @@ func (s recordingVideoSlot) Run(
|
||||
initial FeedConfig,
|
||||
commands <-chan FeedConfig,
|
||||
) error {
|
||||
s.events <- controllerEvent{unit: UnitVideo, action: "start", feed: initial}
|
||||
s.events <- controllerEvent{
|
||||
unit: UnitVideo, action: "start",
|
||||
generation: generationFromContext(ctx), feed: initial,
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case config := <-commands:
|
||||
@@ -120,7 +124,10 @@ func (s recordingAudioSlot) Run(
|
||||
initial FeedConfig,
|
||||
commands <-chan FeedConfig,
|
||||
) error {
|
||||
s.events <- controllerEvent{unit: UnitAudio, action: "start", feed: initial}
|
||||
s.events <- controllerEvent{
|
||||
unit: UnitAudio, action: "start",
|
||||
generation: generationFromContext(ctx), feed: initial,
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case config := <-commands:
|
||||
@@ -139,7 +146,10 @@ func (s recordingSyncSlot) Run(
|
||||
initial SyncPairConfig,
|
||||
commands <-chan SyncPairConfig,
|
||||
) error {
|
||||
s.events <- controllerEvent{unit: UnitSync, action: "start", pair: initial}
|
||||
s.events <- controllerEvent{
|
||||
unit: UnitSync, action: "start",
|
||||
generation: generationFromContext(ctx), pair: initial,
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case config := <-commands:
|
||||
@@ -291,6 +301,9 @@ func TestSessionControllerStopsIndependentSlotsBeforeStartingSync(t *testing.T)
|
||||
if !stopped[UnitVideo] || !stopped[UnitAudio] {
|
||||
t.Fatalf("sync started before both independent slots stopped: %v", stopped)
|
||||
}
|
||||
if event.generation != 2 {
|
||||
t.Fatalf("sync runtime generation = %d, want 2", event.generation)
|
||||
}
|
||||
break
|
||||
}
|
||||
if event.action != "stop" || (event.unit != UnitVideo && event.unit != UnitAudio) {
|
||||
|
||||
Reference in New Issue
Block a user