Skip to content

Commit

Permalink
[paplayer] - when player is paused - don't process streams but just y…
Browse files Browse the repository at this point in the history
…ield cpu to other threads
  • Loading branch information
Memphiz committed Dec 9, 2012
1 parent e551803 commit 470cb07
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xbmc/cores/paplayer/PAPlayer.cpp
Expand Up @@ -463,6 +463,13 @@ void PAPlayer::Process()

double delay = 100.0;
double buffer = 100.0;

if (IsPaused())
{
CThread::Sleep(10);
continue;
}

ProcessStreams(delay, buffer);

double watermark = buffer * 0.5;
Expand Down

5 comments on commit 470cb07

@davilla
Copy link
Collaborator

@davilla davilla commented on 470cb07 Dec 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sleep() instead of CThread::Sleep(), this code is in PAPlayer::Process and the inherited Sleep has a check for bStop so it will abort if the the PAPlayer thread is stopped. 10ms is not much but hey, it all adds up :)

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on 470cb07 Dec 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same sleep is used 5 lines down for sleeping the watermark stuff. What is the issue when the sleep gets aborted when paplayer thread is stopped? This even would be nice imo?

And i could increase it to 100ms if we want :)

@davilla
Copy link
Collaborator

@davilla davilla commented on 470cb07 Dec 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess who every added the other did not know about how the inherited Sleep works, or it was some cp monster running around :)

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on 470cb07 Dec 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what is the problem with sleep aborting when m_bStop is set? The thread is going to stop then anyway - so?

@davilla
Copy link
Collaborator

@davilla davilla commented on 470cb07 Dec 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no problem, I'm confused :) Sleep() and CThread::Sleep() are the same thing inside a CThread

Please sign in to comment.