You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implemented stream pooling support for cross-provider failover scenarios. Previously, when a channel failed over to a different provider, pooling detection would fail because it searched by the failover channel's ID rather than the original requested channel ID.
### Problem
1. **Provider Profile Pooling** (issue #651 ): Streams from failover sources weren't detected during pooling checks, causing duplicate streams when using pooled provider profiles
2. **Cross-Provider Failover Pooling**: When Channel 123 (Provider A) failed over to Channel 456 (Provider B), the system couldn't pool streams because it searched for Channel 456's ID instead of the originally requested Channel 123
### Solution
Track both the requested resource (what the user asked for) and the actual source (what's currently streaming) separately:
- original_channel_id: The channel ID originally requested
- original_playlist_uuid: The playlist UUID originally requested
- id: The actual channel ID streaming (may be different due to failover)
- playlist_uuid: The actual playlist UUID (may be different due to failover)
- is_failover: Boolean flag indicating if stream is from a failover source
Copy file name to clipboardExpand all lines: docs/stream-pooling.md
+29-12Lines changed: 29 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,14 +100,19 @@ The m3u-proxy handles the actual stream pooling:
100
100
1.**Stream Creation**: Each transcoded stream includes metadata:
101
101
```json
102
102
{
103
-
"id": "12345",
103
+
"id": "456",
104
104
"type": "channel",
105
-
"playlist_uuid": "abc-def-123",
105
+
"playlist_uuid": "provider-b-uuid",
106
106
"transcoding": "true",
107
107
"profile_id": "5",
108
-
"provider_profile_id": "2"
108
+
"provider_profile_id": "2",
109
+
"original_channel_id": "123",
110
+
"original_playlist_uuid": "provider-a-uuid",
111
+
"is_failover": true
109
112
}
110
113
```
114
+
115
+
Note: `id` and `playlist_uuid` represent the ACTUAL source, while `original_*` fields track the REQUESTED channel for cross-provider pooling.
111
116
112
117
2.**Client Registration**: Multiple clients can register to the same stream
113
118
3.**FFmpeg Process Sharing**: All clients receive data from the same FFmpeg transcoding process
@@ -163,12 +168,14 @@ Provider limits are respected automatically:
163
168
### For Pooling to Work
164
169
165
170
1.**Transcoding must be enabled** (profile parameter provided)
166
-
2.**Same channel** (same channel ID)
167
-
3.**Same playlist** (same playlist UUID)
171
+
2.**Same original channel** (same original channel ID - even if served from different failover sources)
172
+
3.**Same original playlist** (same original playlist UUID - even if served from different failover playlists)
168
173
4.**Same transcoding profile** (StreamProfile ID)
169
174
5.**Same provider profile** (PlaylistProfile ID, if using pooled provider profiles)
170
175
6.**Stream still active** (has at least one connected client)
171
176
177
+
**New in v1.x**: Pooling now works across cross-provider failovers! If Channel 123 from Provider A fails over to Channel 456 from Provider B, subsequent requests for Channel 123 will correctly pool into the existing stream.
178
+
172
179
### Direct Streams (Non-Transcoded)
173
180
174
181
Direct streams (without transcoding) **do NOT pool** because:
@@ -220,20 +227,30 @@ Look for these log messages:
220
227
221
228
### m3u-editor Logs
222
229
```
223
-
[INFO] Found existing pooled transcoded stream
230
+
[INFO] Found existing pooled transcoded stream (cross-provider failover support)
224
231
stream_id: abc123...
225
-
channel_id: 12345
226
-
playlist_uuid: xyz789...
232
+
original_channel_id: 123
233
+
original_playlist_uuid: provider-a-uuid
234
+
actual_channel_id: 456
235
+
actual_playlist_uuid: provider-b-uuid
236
+
is_failover: true
227
237
profile_id: 5
228
238
provider_profile_id: 2
229
239
client_count: 3
230
240
231
241
[INFO] Reusing existing pooled transcoded stream (bypassing capacity check)
232
242
stream_id: abc123...
233
-
channel_id: 12345
234
-
playlist_uuid: xyz789...
243
+
original_channel_id: 123
244
+
original_playlist_uuid: provider-a-uuid
235
245
profile_id: 5
236
246
provider_profile_id: 2
247
+
248
+
[DEBUG] Creating transcoded stream with failover tracking
0 commit comments