-
Notifications
You must be signed in to change notification settings - Fork 132
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
[Proposal] types: simplify types for PlaybackObserver #1589
base: dev
Are you sure you want to change the base?
Conversation
As the |
@@ -1,76 +1,21 @@ | |||
import type { ICorePlaybackObservation } from "../main_thread/init/utils/create_core_playback_observer"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency also looks kind of wrong to me.
The PlaybackObserver shouldn't be dependent on main_thread
to me, the reverse should.
f60ae8c
to
0e1208a
Compare
@@ -36,6 +33,7 @@ import SharedReference from "../../utils/reference"; | |||
import type { CancellationSignal } from "../../utils/task_canceller"; | |||
import TaskCanceller from "../../utils/task_canceller"; | |||
import type { IBufferType } from "../segment_sinks"; | |||
import type { IAdaptationStreamPlaybackObservation } from "../stream/adaptation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it weird that the ABR rely on a type defined inside another module it does not care about?
Maybe we should put that type in a more neutral place
src/core/cmcd/cmcd_data_builder.ts
Outdated
ObservationPosition, | ||
} from "../../playback_observer"; | ||
import type { IReadOnlyPlaybackObserver } from "../../playback_observer"; | ||
import type { ICorePlaybackObservation } from "../../playback_observer/types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could maybe just re-export it just from the playback_observer
path
src/core/stream/adaptation/types.ts
Outdated
import type { IReadOnlySharedReference } from "../../../utils/reference"; | ||
import type { IRepresentationEstimator } from "../../adaptive"; | ||
import type { SegmentQueueCreator } from "../../fetchers"; | ||
import type { IBufferType, SegmentSink } from "../../segment_sinks"; | ||
import type { IPeriodStreamPlaybackObservation } from "../period"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me the PeriodStream depends on the AdaptationStream, not the other way around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that they don't overlap well, IAdaptationStreamPlaybackObservation
has bufferGap
attribute in addition of the other attributes that as IPeriodStreamPlaybackObservation
.
But they both defines the buffered
attribute in a different way.
I will just define them as both types with no extends
nor Omit
@@ -20,6 +17,7 @@ import type { IRange } from "../../../utils/ranges"; | |||
import type { IReadOnlySharedReference } from "../../../utils/reference"; | |||
import type { SegmentQueue } from "../../fetchers"; | |||
import type { IBufferType, SegmentSink } from "../../segment_sinks"; | |||
import type { IAdaptationStreamPlaybackObservation } from "../adaptation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote it as a comment but you may have not seen it:
As the AdaptationStream is the one that has a dependency on the RepresentationStream, shouldn't the type be coming from the RepresentationStream to the AdaptationStream and not the reverse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IAdaptationStreamPlaybackObservation
and IRepresentationStreamPlaybackObservation
are the same so I deleted the Representation one.
Yeah name is a bit off because of that, should I rename it? Any idea of a name that would fit for both? Or I can duplicate it but I'm not fan of..
@@ -32,7 +32,7 @@ import type { | |||
IPushChunkInfos, | |||
SegmentSink, | |||
} from "../../../segment_sinks"; | |||
import type { IRepresentationStreamPlaybackObservation } from "../types"; | |||
import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
IRepresentationStreamPlaybackObservation, | ||
IQueuedSegment, | ||
} from "../types"; | ||
import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
IRepresentationStreamPlaybackObservation, | ||
IStreamEventAddedSegmentPayload, | ||
} from "../types"; | ||
import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
IRepresentationStreamPlaybackObservation, | ||
IStreamEventAddedSegmentPayload, | ||
} from "../types"; | ||
import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -58,6 +58,7 @@ import type { ITextDisplayer } from "../text_displayer"; | |||
import sendMessage from "./send_message"; | |||
import type { ITextDisplayerOptions } from "./types"; | |||
import { ContentInitializer } from "./types"; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that blank line wanted?
* loading (and thus paused) but with autoPlay enabled. | ||
*/ | ||
pending: boolean | undefined; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me the PlaybackObserver
has no concept of what the AdaptationStream
or RepresentationStream
is.
For "core" I'm ok with.
This is mainly a naming issue for me.
Part of the code relies on the
PlaybackObserver
and redefines the properties needed in thePlaybackObservation
it's listening to.The types
IRepresentationEstimatorPlaybackObservation
IWorkerPlaybackObservation
ICmcdDataBuilderPlaybackObservation
Are all subsets of
ICorePlaybackObservation
, I propose to remove those types and replace them withICorePlaybackObservation
Similarly I removed the type
IRepresentationStreamPlaybackObservation
to only useIAdaptationStreamPlaybackObservation