Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker: cleanup #1496

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions worker/src/RTC/SimulcastConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace RTC

if (this->preferredSpatialLayer > encoding.spatialLayers - 1)
{
this->preferredSpatialLayer = encoding.spatialLayers - 1;
this->preferredSpatialLayer = static_cast<int16_t>(encoding.spatialLayers - 1);
}

if (preferredLayers->temporalLayer().has_value())
Expand All @@ -69,20 +69,20 @@ namespace RTC

if (this->preferredTemporalLayer > encoding.temporalLayers - 1)
{
this->preferredTemporalLayer = encoding.temporalLayers - 1;
this->preferredTemporalLayer = static_cast<int16_t>(encoding.temporalLayers - 1);
}
}
else
{
this->preferredTemporalLayer = encoding.temporalLayers - 1;
this->preferredTemporalLayer = static_cast<int16_t>(encoding.temporalLayers - 1);
}
}
else
{
// Initially set preferredSpatialLayer and preferredTemporalLayer to the
// maximum value.
this->preferredSpatialLayer = encoding.spatialLayers - 1;
this->preferredTemporalLayer = encoding.temporalLayers - 1;
this->preferredSpatialLayer = static_cast<int16_t>(encoding.spatialLayers - 1);
this->preferredTemporalLayer = static_cast<int16_t>(encoding.temporalLayers - 1);
}

// Reserve space for the Producer RTP streams by filling all the possible
Expand Down Expand Up @@ -245,7 +245,7 @@ namespace RTC

if (this->preferredSpatialLayer > this->rtpStream->GetSpatialLayers() - 1)
{
this->preferredSpatialLayer = this->rtpStream->GetSpatialLayers() - 1;
this->preferredSpatialLayer = static_cast<int16_t>(this->rtpStream->GetSpatialLayers() - 1);
}

// preferredTemporaLayer is optional.
Expand All @@ -255,12 +255,14 @@ namespace RTC

if (this->preferredTemporalLayer > this->rtpStream->GetTemporalLayers() - 1)
{
this->preferredTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
this->preferredTemporalLayer =
static_cast<int16_t>(this->rtpStream->GetTemporalLayers() - 1);
}
}
else
{
this->preferredTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
this->preferredTemporalLayer =
static_cast<int16_t>(this->rtpStream->GetTemporalLayers() - 1);
}

MS_DEBUG_DEV(
Expand Down Expand Up @@ -1563,7 +1565,7 @@ namespace RTC
}
else if (newTargetSpatialLayer < this->preferredSpatialLayer)
{
newTargetTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
newTargetTemporalLayer = static_cast<int16_t>(this->rtpStream->GetTemporalLayers() - 1);
}
else
{
Expand Down
17 changes: 9 additions & 8 deletions worker/src/RTC/SvcConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,28 @@ namespace RTC

if (this->preferredSpatialLayer > encoding.spatialLayers - 1)
{
this->preferredSpatialLayer = encoding.spatialLayers - 1;
this->preferredSpatialLayer = static_cast<int16_t>(encoding.spatialLayers - 1);
}

if (flatbuffers::IsFieldPresent(
data->preferredLayers(), FBS::Consumer::ConsumerLayers::VT_TEMPORALLAYER))
{
if (this->preferredTemporalLayer > encoding.temporalLayers - 1)
{
this->preferredTemporalLayer = encoding.temporalLayers - 1;
this->preferredTemporalLayer = static_cast<int16_t>(encoding.temporalLayers - 1);
}
}
else
{
this->preferredTemporalLayer = encoding.temporalLayers - 1;
this->preferredTemporalLayer = static_cast<int16_t>(encoding.temporalLayers - 1);
}
}
else
{
// Initially set preferredSpatialLayer and preferredTemporalLayer to the
// maximum value.
this->preferredSpatialLayer = encoding.spatialLayers - 1;
this->preferredTemporalLayer = encoding.temporalLayers - 1;
this->preferredSpatialLayer = static_cast<int16_t>(encoding.spatialLayers - 1);
this->preferredTemporalLayer = static_cast<int16_t>(encoding.temporalLayers - 1);
}

// Create the encoding context.
Expand Down Expand Up @@ -223,7 +223,7 @@ namespace RTC

if (this->preferredSpatialLayer > this->rtpStream->GetSpatialLayers() - 1)
{
this->preferredSpatialLayer = this->rtpStream->GetSpatialLayers() - 1;
this->preferredSpatialLayer = static_cast<int16_t>(this->rtpStream->GetSpatialLayers() - 1);
}

// preferredTemporaLayer is optional.
Expand All @@ -233,7 +233,8 @@ namespace RTC

if (this->preferredTemporalLayer > this->rtpStream->GetTemporalLayers() - 1)
{
this->preferredTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
this->preferredTemporalLayer =
static_cast<int16_t>(this->rtpStream->GetTemporalLayers() - 1);
}
}
else
Expand Down Expand Up @@ -1181,7 +1182,7 @@ namespace RTC
}
else if (newTargetSpatialLayer < this->preferredSpatialLayer)
{
newTargetTemporalLayer = this->rtpStream->GetTemporalLayers() - 1;
newTargetTemporalLayer = static_cast<int16_t>(this->rtpStream->GetTemporalLayers() - 1);
}
else
{
Expand Down
15 changes: 1 addition & 14 deletions worker/src/Worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,27 +520,14 @@ void Worker::OnSignal(SignalHandle* /*signalHandle*/, int signum)
switch (signum)
{
case SIGINT:
{
if (this->closed)
{
return;
}

MS_DEBUG_DEV("INT signal received, closing myself");

Close();

break;
}

case SIGTERM:
{
if (this->closed)
{
return;
}

MS_DEBUG_DEV("TERM signal received, closing myself");
MS_DEBUG_DEV("%s signal received, closing myself", signum == SIGINT ? "INT" : "TERM");

Close();

Expand Down
Loading