Skip to content

Commit

Permalink
Log an error and return if we receive an invalid number of arguments …
Browse files Browse the repository at this point in the history
…with a DONE_RECORDING event. Ideally what we'd do here is send an event back to the backend reporting an error (truncation, corruption?) and asking the event be re-sent but the framework just isn't there.
  • Loading branch information
stuartm committed Mar 23, 2013
1 parent 088d684 commit 0ede677
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -9299,12 +9299,22 @@ void TV::customEvent(QEvent *e)
{
int seconds = 0;
//long long frames = 0;
if (tokens.size() >= 4)
int NUMTOKENS = 4; // Number of tokens expected
if (tokens.size() == NUMTOKENS)
{
cardnum = tokens[1].toUInt();
seconds = tokens[2].toInt();
//frames = tokens[3].toLongLong();
}
else
{
LOG(VB_GENERAL, LOG_ERR, QString("DONE_RECORDING event received "
"with invalid number of arguments, "
"%1 expected, %2 actual")
.arg(NUMTOKENS-1)
.arg(tokens.size()-1));
return;
}

PlayerContext *mctx = GetPlayerReadLock(0, __FILE__, __LINE__);
for (uint i = 0; mctx && (i < player.size()); i++)
Expand All @@ -9318,7 +9328,8 @@ void TV::customEvent(QEvent *e)
if (ctx->player)
{
ctx->player->SetWatchingRecording(false);
ctx->player->SetLength(seconds);
if (seconds > 0)
ctx->player->SetLength(seconds);
}
ctx->UnlockDeletePlayer(__FILE__, __LINE__);

Expand All @@ -9335,7 +9346,8 @@ void TV::customEvent(QEvent *e)
if (ctx->player)
{
ctx->player->SetWatchingRecording(false);
ctx->player->SetLength(seconds);
if (seconds > 0)
ctx->player->SetLength(seconds);
}
ctx->UnlockDeletePlayer(__FILE__, __LINE__);
}
Expand Down

0 comments on commit 0ede677

Please sign in to comment.