Skip to content

Commit

Permalink
Remove necessity to send added segment data as event
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Sep 1, 2023
1 parent 926b484 commit f7f8c7a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 21 deletions.
2 changes: 0 additions & 2 deletions src/core/init/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ export interface IContentInitializerEvents {
segment : ISegment;
/** TimeRanges of the concerned SegmentBuffer after the segment was pushed. */
buffered : TimeRanges | null;
/* The data pushed */
segmentData : unknown;
};
/**
* Event emitted when one or multiple inband events (i.e. events inside a
Expand Down
8 changes: 4 additions & 4 deletions src/core/stream/adaptation/adaptation_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
* triggered, to immediately stop all operations the `AdaptationStream` is
* doing.
*/
export default function AdaptationStream<T>(
export default function AdaptationStream(
{ playbackObserver,
content,
options,
Expand All @@ -66,7 +66,7 @@ export default function AdaptationStream<T>(
segmentFetcherCreator,
wantedBufferAhead,
maxVideoBufferSize } : IAdaptationStreamArguments,
callbacks : IAdaptationStreamCallbacks<T>,
callbacks : IAdaptationStreamCallbacks,
parentCancelSignal : CancellationSignal
) : void {
const { manifest, period, adaptation } = content;
Expand Down Expand Up @@ -298,7 +298,7 @@ export default function AdaptationStream<T>(
return ; // previous callback has stopped everything by side-effect
}

const representationStreamCallbacks : IRepresentationStreamCallbacks<T> = {
const representationStreamCallbacks : IRepresentationStreamCallbacks = {
streamStatusUpdate: callbacks.streamStatusUpdate,
encryptionDataEncountered: callbacks.encryptionDataEncountered,
manifestMightBeOufOfSync: callbacks.manifestMightBeOufOfSync,
Expand Down Expand Up @@ -346,7 +346,7 @@ export default function AdaptationStream<T>(
function createRepresentationStream(
representation : Representation,
terminateCurrentStream : IReadOnlySharedReference<ITerminationOrder | null>,
representationStreamCallbacks : IRepresentationStreamCallbacks<T>,
representationStreamCallbacks : IRepresentationStreamCallbacks,
fnCancelSignal : CancellationSignal
) : void {
const bufferGoalCanceller = new TaskCanceller();
Expand Down
4 changes: 2 additions & 2 deletions src/core/stream/adaptation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
} from "../representation";

/** Callbacks called by the `AdaptationStream` on various events. */
export interface IAdaptationStreamCallbacks<T>
extends Omit<IRepresentationStreamCallbacks<T>, "terminating">
export interface IAdaptationStreamCallbacks
extends Omit<IRepresentationStreamCallbacks, "terminating">
{
/** Called as new bitrate estimates are done. */
bitrateEstimateChange(payload : IBitrateEstimateChangePayload) : void;
Expand Down
2 changes: 1 addition & 1 deletion src/core/stream/period/period_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function createEmptyAdaptationStream(
wantedBufferAhead : IReadOnlySharedReference<number>,
bufferType : IBufferType,
content : { period : Period },
callbacks : Pick<IAdaptationStreamCallbacks<unknown>, "streamStatusUpdate">,
callbacks : Pick<IAdaptationStreamCallbacks, "streamStatusUpdate">,
cancelSignal : CancellationSignal
) : void {
const { period } = content;
Expand Down
2 changes: 1 addition & 1 deletion src/core/stream/period/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { IPositionPlaybackObservation } from "../representation";

/** Callbacks called by the `AdaptationStream` on various events. */
export interface IPeriodStreamCallbacks extends
IAdaptationStreamCallbacks<unknown>
IAdaptationStreamCallbacks
{
/**
* Called when a new `PeriodStream` is ready to start but needs an Adaptation
Expand Down
2 changes: 1 addition & 1 deletion src/core/stream/representation/representation_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function RepresentationStream<TSegmentDataType>(
segmentBuffer,
segmentFetcher,
terminate } : IRepresentationStreamArguments<TSegmentDataType>,
callbacks : IRepresentationStreamCallbacks<TSegmentDataType>,
callbacks : IRepresentationStreamCallbacks,
parentCancelSignal : CancellationSignal
) : void {
const { period, adaptation, representation } = content;
Expand Down
8 changes: 3 additions & 5 deletions src/core/stream/representation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "../../segment_buffers";

/** Callbacks called by the `RepresentationStream` on various events. */
export interface IRepresentationStreamCallbacks<TSegmentDataType> {
export interface IRepresentationStreamCallbacks {
/**
* Called to announce the current status regarding the buffer for its
* associated Period and type (e.g. "audio", "video", "text" etc.).
Expand All @@ -30,7 +30,7 @@ export interface IRepresentationStreamCallbacks<TSegmentDataType> {
*/
streamStatusUpdate(payload : IStreamStatusPayload) : void;
/** Called after a new segment has been succesfully added to the SegmentBuffer */
addedSegment(payload : IStreamEventAddedSegmentPayload<TSegmentDataType>) : void;
addedSegment(payload : IStreamEventAddedSegmentPayload) : void;
/** Called when a segment with protection information has been encountered. */
encryptionDataEncountered(payload : IContentProtection[]) : void;
/**
Expand Down Expand Up @@ -127,7 +127,7 @@ export interface IStreamStatusPayload {
}

/** Payload for the `addedSegment` callback. */
export interface IStreamEventAddedSegmentPayload<T> {
export interface IStreamEventAddedSegmentPayload {
/** Context about the content that has been added. */
content: { period : Period;
adaptation : Adaptation;
Expand All @@ -136,8 +136,6 @@ export interface IStreamEventAddedSegmentPayload<T> {
segment : ISegment;
/** TimeRanges of the concerned SegmentBuffer after the segment was pushed. */
buffered : TimeRanges | null;
/* The data pushed */
segmentData : T;
}

/** Structure describing an "inband" event, as found in a media segment. */
Expand Down
5 changes: 2 additions & 3 deletions src/core/stream/representation/utils/push_init_segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export default async function pushInitSegment<T>(
content,
initSegmentUniqueId,
segment,
segmentData,
segmentBuffer,
} : {
playbackObserver : IReadOnlyPlaybackObserver<
Expand All @@ -61,7 +60,7 @@ export default async function pushInitSegment<T>(
segmentBuffer : SegmentBuffer;
},
cancelSignal : CancellationSignal
) : Promise< IStreamEventAddedSegmentPayload<T> | null > {
) : Promise< IStreamEventAddedSegmentPayload | null > {
if (cancelSignal.cancellationError !== null) {
throw cancelSignal.cancellationError;
}
Expand All @@ -80,5 +79,5 @@ export default async function pushInitSegment<T>(
segmentBuffer,
{ data, inventoryInfos },
cancelSignal);
return { content, segment, buffered: null, segmentData };
return { content, segment, buffered: null };
}
4 changes: 2 additions & 2 deletions src/core/stream/representation/utils/push_media_segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default async function pushMediaSegment<T>(
segment : ISegment;
segmentBuffer : SegmentBuffer; },
cancelSignal : CancellationSignal
) : Promise< IStreamEventAddedSegmentPayload<T> | null > {
) : Promise< IStreamEventAddedSegmentPayload | null > {
if (parsedSegment.chunkData === null) {
return null;
}
Expand Down Expand Up @@ -108,5 +108,5 @@ export default async function pushMediaSegment<T>(
segmentBuffer,
{ data, inventoryInfos },
cancelSignal);
return { content, segment, buffered: null, segmentData: chunkData };
return { content, segment, buffered: null };
}

0 comments on commit f7f8c7a

Please sign in to comment.