Skip to content

Commit 9ee585d

Browse files
committed
refacto: Rename stream submodules to improve readability
1 parent 415eb5c commit 9ee585d

41 files changed

Lines changed: 402 additions & 392 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ it:
9191
Stream (./core/stream) │ │ └──────┐
9292
┌────────────────────────┼────────────────────────────────┐ │ │
9393
│ ▼ │ └─────────┐ │
94-
│ Create PeriodStreams ┌────────────────────────────┐ │ Ask to │ │
94+
│ Create TrackSelectorStreams ┌────────────────────────────┐ │ Ask to │ │
9595
│ based on the position │ StreamOrchestrator │ │ load │ │
9696
│ and settings │(./core/stream/orchestrator)│ │ and │ │
9797
│ └────────────────────────────┘ │ parse │ │
@@ -100,7 +100,7 @@ Stream (./core/stream) │ │ └─
100100
│ │ │ │ │ │ │
101101
│ (audio) ▼ (video) ▼ (text) ▼ │ │ │
102102
│ Create the right ┌────────┐ ┌────────┐ ┌────────┐ uses┌────────────┐ │ │
103-
AdaptationStream │ │ │ │ │ │────>│SegmentSinks│ │ │
103+
RepresentationSelector │ │ │ │ │ │────>│SegmentSinks│ │ │
104104
│ depending on the │ Period │─┐ │ Period │─┐ │ Period │─┐ │ │ Store │ │ │
105105
│ wanted track │ Stream │ │ │ Stream │ │ │ Stream │ │ │ │(./core/segm│ │ │
106106
│ (One per Period │ │ │ │ │ │ │ │ │ │ │ent_sinks) │ │ │

src/core/entry/core_entry.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,7 @@ function loadPreparedContent(
612612

613613
/**
614614
* Stores last discontinuity update sent to the Core for each Period and type
615-
* combinations, at least until the corresponding `PeriodStreamCleared`
616-
* message.
615+
* combinations, at least until the corresponding `StreamCleared` message.
617616
*
618617
* This is an optimization to avoid sending too much discontinuity messages to
619618
* the main thread when it is not needed because nothing changed.
@@ -853,7 +852,7 @@ function loadPreparedContent(
853852
});
854853
},
855854

856-
periodStreamReady(value) {
855+
streamReady(value) {
857856
if (preparedContent === null) {
858857
return;
859858
}
@@ -863,13 +862,13 @@ function loadPreparedContent(
863862
value.adaptationRef,
864863
);
865864
sendMessage({
866-
type: CoreMessageType.PeriodStreamReady,
865+
type: CoreMessageType.StreamReady,
867866
contentId,
868867
value: { periodId: value.period.id, bufferType: value.type },
869868
});
870869
},
871870

872-
periodStreamCleared(value) {
871+
streamCleared(value) {
873872
if (preparedContent === null) {
874873
return;
875874
}
@@ -890,7 +889,7 @@ function loadPreparedContent(
890889
value.type,
891890
);
892891
sendMessage({
893-
type: CoreMessageType.PeriodStreamCleared,
892+
type: CoreMessageType.StreamCleared,
894893
contentId,
895894
value: { periodId: value.period.id, bufferType: value.type },
896895
});

src/core/stream/orchestrator/README.md renamed to src/core/stream/1-Period_selection/README.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ less permissive way than custom ones:
9292
- An error coming from one of them will lead us to completely stop the content on a fatal
9393
error
9494

95-
## PeriodStreams
95+
## TrackSelectorStreams
9696

9797
The _DASH_ streaming technology has a concept called _Period_. Simply put, it allows to
9898
set various types of content successively in the same manifest.
@@ -126,11 +126,11 @@ As such, they have to be considered separately - in a different Period:
126126
TV Show Italian Film American film
127127
```
128128

129-
In the RxPlayer, we create one _PeriodStream_ per Period **and** per type.
129+
In the RxPlayer, we create one _TrackSelectorStream_ per Period **and** per type.
130130

131-
_PeriodStreams_ are automatically created/destroyed during playback. The job of a single
132-
_PeriodStream_ is to process and download optimally the content linked to a single
133-
_Period_ and to a single type:
131+
_TrackSelectorStreams_ are automatically created/destroyed during playback. The job of a
132+
single _TrackSelectorStream_ is to process and download optimally the content linked to a
133+
single _Period_ and to a single type:
134134

135135
```
136136
- VIDEO BUFFER -
@@ -159,7 +159,7 @@ _Period_ and to a single type:
159159

160160
To allow smooth transitions between them, we also might want to preload content defined by
161161
a subsequent _Period_ once we lean towards the end of the content described by the
162-
previous one. Thus, multiple _PeriodStreams_ might be active at the same time:
162+
previous one. Thus, multiple _TrackSelectorStreams_ might be active at the same time:
163163

164164
```
165165
+---------------------------- AUDIO ----------------------------------+
@@ -189,16 +189,16 @@ previous one. Thus, multiple _PeriodStreams_ might be active at the same time:
189189

190190
### Multi-Period management
191191

192-
The creation/destruction of _PeriodStreams_ is actually done in a very precize and optimal
193-
way, which gives a higher priority to immediate content.
192+
The creation/destruction of _TrackSelectorStreams_ is actually done in a very precize and
193+
optimal way, which gives a higher priority to immediate content.
194194

195195
To better grasp how it works, let's imagine a regular use-case, with two periods for a
196196
single type of buffer:
197197

198198
---
199199

200-
Let's say that the _PeriodStream_ for the first _Period_ (named P1) is currently actively
201-
downloading segments (the "^" sign is the current position):
200+
Let's say that the _TrackSelectorStream_ for the first _Period_ (named P1) is currently
201+
actively downloading segments (the "^" sign is the current position):
202202

203203
```
204204
P1
@@ -214,7 +214,7 @@ Once P1 is full (it has no segment left to download):
214214
^
215215
```
216216

217-
We will be able to create a new _PeriodStream_, P2, for the second _Period_:
217+
We will be able to create a new _TrackSelectorStream_, P2, for the second _Period_:
218218

219219
```
220220
P1 P2
@@ -259,15 +259,15 @@ Once P1, goes full again, we re-create P2:
259259
_Note that we still have the segment pushed to P2 available in the corresponding media
260260
buffer_
261261

262-
When the current position go ahead of a _PeriodStream_ (here ahead of P1):
262+
When the current position go ahead of a _TrackSelectorStream_ (here ahead of P1):
263263

264264
```
265265
P1 P2
266266
|======|=== |
267267
^
268268
```
269269

270-
This _PeriodStream_ is destroyed to free up ressources:
270+
This _TrackSelectorStream_ is destroyed to free up ressources:
271271

272272
```
273273
P2
@@ -277,15 +277,15 @@ This _PeriodStream_ is destroyed to free up ressources:
277277

278278
---
279279

280-
When the current position goes behind the first currently defined _PeriodStream_:
280+
When the current position goes behind the first currently defined _TrackSelectorStream_:
281281

282282
```
283283
P2
284284
|=== |
285285
^
286286
```
287287

288-
Then we destroy all previous _PeriodStreams_ and [re-]create the one needed:
288+
Then we destroy all previous _TrackSelectorStreams_ and [re-]create the one needed:
289289

290290
```
291291
P1
@@ -305,7 +305,8 @@ re-create P2, which will also keep its already-pushed segments:
305305
---
306306

307307
For multiple types of buffers (example: _audio_ and _video_) the same logic is repeated
308-
(and separated) as many times. An _audio_ _PeriodStream_ will not influence a _video_ one:
308+
(and separated) as many times. An _audio_ _TrackSelectorStream_ will not influence a
309+
_video_ one:
309310

310311
```
311312
--------------------------- AUDIO --------------------------------
@@ -324,13 +325,14 @@ For multiple types of buffers (example: _audio_ and _video_) the same logic is r
324325
^
325326
```
326327

327-
At the end, we should only have _PeriodStream[s]_ for consecutive Period[s]:
328+
At the end, we should only have _TrackSelectorStream[s]_ for consecutive Period[s]:
328329

329330
- The first chronological one is the one currently seen by the user.
330331
- The last chronological one is the only one downloading content.
331-
- In between, we only have full consecutive _PeriodStreams_.
332+
- In between, we only have full consecutive _TrackSelectorStreams_.
332333

333334
### Communication with the API
334335

335-
Any "Stream" communicates to the API about creations and destructions of _PeriodStreams_
336-
respectively through `"periodStreamReady"` and `"periodStreamCleared"` callbacks.
336+
Any "Stream" communicates to the API about creations and destructions of
337+
_TrackSelectorStreams_ respectively through `"streamReady"` and `"streamCleared"`
338+
callbacks.

src/core/stream/orchestrator/get_time_ranges_for_content.ts renamed to src/core/stream/1-Period_selection/get_time_ranges_for_content.ts

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)