@100mslive/hms-video-store 0.15.2-alpha.2 → 0.15.2-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,6 +79,20 @@ export default class HMSTransport {
79
79
  publish(tracks: Array<HMSLocalTrack>): Promise<void>;
80
80
  unpublish(tracks: Array<HMSLocalTrack>): Promise<void>;
81
81
  setSFUNodeId(id?: string): void;
82
+ /**
83
+ * A part-way migration leaves the old connections closed, trackStates cleared and the
84
+ * republish incomplete, and nothing retries it. Counted on its own event, not `publish.failed`
85
+ * — that one already holds ordinary publish errors. Not onStateChange(Failed): that is
86
+ * internalLeave, and a transient signal loss here would eject a recoverable peer.
87
+ */
88
+ private reportSFUMigrationFailure;
89
+ /**
90
+ * True when the live publish connection will carry this track in its next offer — the
91
+ * transceiver is attached to that connection and trackStates still names it. Keyed on state,
92
+ * not on the error code: 4008 also covers 'publish connection is gone', where nothing is
93
+ * staged, and a WebSocketConnectionLost from signal.offer can leave the track fully staged.
94
+ */
95
+ private isTrackStagedForPublish;
82
96
  /**
83
97
  * Republishes one cloned track during migration. The old track is already stopped by the
84
98
  * time we get here, so one failure must not abort the tracks still to be republished —
@@ -86,12 +100,27 @@ export default class HMSTransport {
86
100
  */
87
101
  private republishOnMigration;
88
102
  handleSFUMigration(): Promise<void>;
103
+ /**
104
+ * A newer NodeInfo starts its own migration, which replaces publishConnection and rebuilds
105
+ * trackStates. Every republish below is a full offer/answer round trip, so ownership has to be
106
+ * re-checked between them: continuing would attach this migration's clones to the newer
107
+ * connection, overwrite the single RENEGOTIATION_CALLBACK_ID slot the newer one is awaiting
108
+ * (hanging it for the rest of the session), and clobber the auxiliaryTracks list it rebuilt.
109
+ */
110
+ private isMigrationSuperseded;
111
+ private performSFUMigration;
89
112
  /**
90
113
  * TODO: check if track.publishedTrackId be used instead of the hack to match with track with same type and
91
114
  * source. The hack won't work if there are multiple tracks with same source and type.
92
115
  */
93
116
  trackUpdate(track: HMSLocalTrack, enabled: boolean): void;
94
117
  private publishTrack;
118
+ /**
119
+ * Drops the track from the offer payload and returns what it dropped, so a failed unpublish
120
+ * can put it back — the caller leaves the track on localPeer and in the store, and without
121
+ * its trackState no later offer would ever carry it again.
122
+ */
123
+ private takeTrackState;
95
124
  private unpublishTrack;
96
125
  /** Local teardown for an unpublished track; one failing step must not skip the others. */
97
126
  private teardownUnpublishedTrack;
@@ -107,12 +136,6 @@ export default class HMSTransport {
107
136
  * Negotiate on first publish after changing role from non-webrtc peer to webrtc peer by sending offer
108
137
  */
109
138
  private negotiateOnFirstPublish;
110
- /**
111
- * Neither caller of negotiateOnFirstPublish catches: handleLocalRoleUpdate propagates into
112
- * HMSSdk with no catch, and handleSFUMigration runs unawaited. A superseded answer means
113
- * another negotiation owns current state, so wire renegotiation and report failure instead —
114
- * without initAfterJoin every later publishTrack would await its promise forever.
115
- */
116
139
  private handleFirstPublishNegotiationError;
117
140
  /**
118
141
  * An answer may only be applied to the offer it answers. Identity covers the connection
@@ -120,9 +143,19 @@ export default class HMSTransport {
120
143
  * setLocalDescription, which is legal in `have-local-offer` and so invisible to
121
144
  * signalingState. Every discard is counted so the discard rate is measurable.
122
145
  */
146
+ private publishAnswerDiscardReason;
147
+ private publishAnswerDiscardError;
148
+ /** Throws unless the answer still belongs to the offer this negotiation staged. */
123
149
  private assertPublishAnswerApplicable;
124
150
  /** Drops our own waiter only: a newer owner armed mid-flight must keep its entry. */
125
151
  private releaseRenegotiationCallback;
152
+ /**
153
+ * Arms the single renegotiation waiter. The slot holds one owner, so whoever takes it has to
154
+ * settle the one it displaces: releaseRenegotiationCallback deliberately keeps the newer
155
+ * entry, so a displaced owner is otherwise never settled and its caller awaits for the rest
156
+ * of the session with the track captured but unpublished.
157
+ */
158
+ private armRenegotiationCallback;
126
159
  private performPublishRenegotiation;
127
160
  private handleIceConnectionFailure;
128
161
  private internalConnect;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Why a publish answer was not applied to the connection. The values are the wire values: they
3
+ * go out verbatim as `reason` on the `publishAnswerDiscarded` analytics event.
4
+ */
5
+ export declare enum PublishAnswerDiscardReason {
6
+ /** handleSFUMigration swapped publishConnection for a different object mid-flight */
7
+ ConnectionReplaced = "connection_replaced",
8
+ /** same connection, but a racer staged a newer local offer */
9
+ SupersededOffer = "superseded_offer",
10
+ /** neither of the above and still not in have-local-offer; counted, never expected */
11
+ UnexpectedState = "unexpected_state"
12
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.15.2-alpha.2",
2
+ "version": "0.15.2-alpha.4",
3
3
  "license": "MIT",
4
4
  "repository": {
5
5
  "type": "git",
@@ -72,5 +72,5 @@
72
72
  "conferencing",
73
73
  "100ms"
74
74
  ],
75
- "gitHead": "5a301d4301bf3bf16809df84b3eb2ac994daa3da"
75
+ "gitHead": "b5c2124b5888507b814cd7e99a843303f3b6f357"
76
76
  }