[Proposal] types: simplify types for PlaybackObserver#1589
[Proposal] types: simplify types for PlaybackObserver#1589Florent-Bouisset wants to merge 7 commits intodevfrom
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.
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
| 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.
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.
We could maybe just re-export it just from the playback_observer path
src/core/stream/adaptation/types.ts
Outdated
| 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.
To me the PeriodStream depends on the AdaptationStream, not the other way around
There was a problem hiding this comment.
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
There was a problem hiding this comment.
We could also use different property names to explicit that difference
| 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.
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.
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..
| SegmentSink, | ||
| } from "../../../segment_sinks"; | ||
| import type { IRepresentationStreamPlaybackObservation } from "../types"; | ||
| import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
| IRepresentationStreamPlaybackObservation, | ||
| IQueuedSegment, | ||
| } from "../types"; | ||
| import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
| IRepresentationStreamPlaybackObservation, | ||
| IStreamEventAddedSegmentPayload, | ||
| } from "../types"; | ||
| import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
| IRepresentationStreamPlaybackObservation, | ||
| IStreamEventAddedSegmentPayload, | ||
| } from "../types"; | ||
| import type { IAdaptationStreamPlaybackObservation } from "../../adaptation"; |
| import sendMessage from "./send_message"; | ||
| import type { ITextDisplayerOptions } from "./types"; | ||
| import { ContentInitializer } from "./types"; | ||
|
|
There was a problem hiding this comment.
Is that blank line wanted?
| * loading (and thus paused) but with autoPlay enabled. | ||
| */ | ||
| pending: boolean | undefined; | ||
| } |
There was a problem hiding this comment.
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.
00fc806 to
b7216b4
Compare
6d4fed2 to
9b856a5
Compare
6cfd206 to
1e55170
Compare
a42734c to
29372ac
Compare
d4be192 to
9ad6758
Compare
0142e34 to
1fd9df3
Compare
Part of the code relies on the
PlaybackObserverand redefines the properties needed in thePlaybackObservationit's listening to.The types
IRepresentationEstimatorPlaybackObservationIWorkerPlaybackObservationICmcdDataBuilderPlaybackObservationAre all subsets of
ICorePlaybackObservation, I propose to remove those types and replace them withICorePlaybackObservationSimilarly I removed the type
IRepresentationStreamPlaybackObservationto only useIAdaptationStreamPlaybackObservation