Worker: New Consumer class handling all possible producer stream modes.#1731
Worker: New Consumer class handling all possible producer stream modes.#1731
Conversation
New ProducerStreamManager interface with the following implementations: - SimpleProducerStreamManager: handles a single stream with no spatial or temporal layers. - SimulcastProducerStreamManager: handles N streams with 1 spatial and N temporal layers. - SvcProducerStreamManager: handles 1 stream with N spatial and M temporal layers. Consumer + SimpleProducerStreamManager replaces SimpleConsumer. Consumer + SimulcastProducerStreamManager replaces SimulcastConsumer. Consumer + SvcProducerStreamManager replaces SvcConsumer.
Consumer::IsActive() checks: - transportConnected - paused - producerPaused - producerClosed ProducerStreamManager::IsActive() checks: - Consumer::IsActive() - Whether producer streams are active
| this->listener->IsActive() && | ||
| std::any_of( | ||
| this->producerRtpStreams.begin(), | ||
| this->producerRtpStreams.end(), |
There was a problem hiding this comment.
warning: use a ranges version of this algorithm [modernize-use-ranges]
worker/src/RTC/SimulcastProducerStreamManager.cpp:4:
- #include "Logger.hpp"
+
+ #include <algorithm>
+ #include "Logger.hpp"| this->producerRtpStreams.end(), | |
| std::ranges::any_of( | |
| this->producerRtpStreams, | |
| , |
| temporalLayer = 0; | ||
|
|
||
| // Check bitrate of every temporal layer. | ||
| for (; temporalLayer < producerRtpStream->GetTemporalLayers(); ++temporalLayer) |
There was a problem hiding this comment.
warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
worker/src/RTC/SimulcastProducerStreamManager.cpp:4:
- #include "Logger.hpp"
+
+ #include <utility>
+ #include "Logger.hpp"| for (; temporalLayer < producerRtpStream->GetTemporalLayers(); ++temporalLayer) | |
| for (; std::cmp_less(temporalLayer , producerRtpStream->GetTemporalLayers()); ++temporalLayer) |
| if (this->keyFrameForTsOffsetRequested) | ||
| { | ||
| // Give up and use the theoretical offset. | ||
| if (tsExtraOffset > maxTsExtraOffset) |
There was a problem hiding this comment.
warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
| if (tsExtraOffset > maxTsExtraOffset) | |
| if (std::cmp_greater(tsExtraOffset , maxTsExtraOffset)) |
| tsExtraOffset = 1u; | ||
| } | ||
| } | ||
| else if (tsExtraOffset > maxTsExtraOffset) |
There was a problem hiding this comment.
warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
| else if (tsExtraOffset > maxTsExtraOffset) | |
| else if (std::cmp_greater(tsExtraOffset , maxTsExtraOffset)) |
| int16_t spatialLayer{ 0 }; | ||
| int16_t temporalLayer{ 0 }; | ||
|
|
||
| for (; spatialLayer < this->producerRtpStream->GetSpatialLayers(); ++spatialLayer) |
There was a problem hiding this comment.
warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
worker/src/RTC/SvcProducerStreamManager.cpp:4:
- #include "Logger.hpp"
+
+ #include <utility>
+ #include "Logger.hpp"| for (; spatialLayer < this->producerRtpStream->GetSpatialLayers(); ++spatialLayer) | |
| for (; std::cmp_less(spatialLayer , this->producerRtpStream->GetSpatialLayers()); ++spatialLayer) |
| temporalLayer = 0; | ||
|
|
||
| // Check bitrate of every temporal layer. | ||
| for (; temporalLayer < this->producerRtpStream->GetTemporalLayers(); ++temporalLayer) |
There was a problem hiding this comment.
warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
| for (; temporalLayer < this->producerRtpStream->GetTemporalLayers(); ++temporalLayer) | |
| for (; std::cmp_less(temporalLayer , this->producerRtpStream->GetTemporalLayers()); ++temporalLayer) |
| goto done; | ||
| } | ||
|
|
||
| for (; spatialLayer < this->producerRtpStream->GetSpatialLayers(); ++spatialLayer) |
There was a problem hiding this comment.
warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
| for (; spatialLayer < this->producerRtpStream->GetSpatialLayers(); ++spatialLayer) | |
| for (; std::cmp_less(spatialLayer , this->producerRtpStream->GetSpatialLayers()); ++spatialLayer) |
New
ProducerStreamManagerinterface with the following implementations:SimpleProducerStreamManager: handles a single stream with no spatial or temporal layers.SimulcastProducerStreamManager: handles N streams with 1 spatial and N temporal layers.SvcProducerStreamManager: handles 1 stream with N spatial and M temporal layers.This new class handles the different flavours of producers streams making
Consumeragnostic. This allows:Consumer + SimpleProducerStreamManagerreplacesSimpleConsumer.Consumer + SimulcastProducerStreamManagerreplacesSimulcastConsumer.Consumer + SvcProducerStreamManagerreplacesSvcConsumer.NOTE1: Old consumer has been named
OldConsumerfor the time being. Old consumers are deprecated and just left in the repo for comparison purposes while this PR is ongoing.NOTE2:
PipeConsumerhas not been touched as we are going to makeConsumerpipe-able and we'll not need any specific consumer implementation for that. Hence pipe consumer tests in NODE are failing. That's OK.NOTE3: This is a work in progress.
TODO: