Stream pooling allows multiple clients to share a single transcoded stream from m3u-proxy without consuming additional provider connections. This is achieved by having m3u-editor check for an existing active stream with matching metadata before requesting a new one.
Comparison of Behaviors
Without Pooling (Old Behavior):
Every user request triggers a new stream creation, leading to multiple provider connections. If a provider has a connection limit (e.g., 1), subsequent users are rejected.
User 1 → m3u-editor → m3u-proxy → Creates Stream A → Provider Connection 1
User 2 → m3u-editor → m3u-proxy → Creates Stream B → Provider Connection 2 ❌ (REJECTED)
With Pooling (New Behavior):
Multiple users reuse the same existing stream and the same underlying provider connection.
User 1 → m3u-editor → m3u-proxy → Creates Stream A → Provider Connection 1
User 2 → m3u-editor → m3u-proxy → Reuses Stream A → SAME Provider Connection ✅
Requirements for Pooling
For pooling to be successful, the following criteria must be met:
- Transcoding must be enabled (a profile parameter must be provided).
- Same original channel: The
original_channel_id must match. - Same original playlist: The
original_playlist_uuid must match. - Same transcoding profile: The
profile_id (StreamProfile ID) must match. - Same provider profile: The
provider_profile_id (PlaylistProfile ID) must match (if using pooled provider profiles). - Active Stream: The stream must still have at least one connected client.
Note: Direct streams (non-transcoded) do NOT pool because they require individual connections to the provider and do not share an FFmpeg process.