forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use semphore in AVThread.waitForStarted
- Loading branch information
Showing
8 changed files
with
41 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -20,6 +20,7 @@ | |
******************************************************************************/ | ||
|
||
#include "AVThread.h" | ||
#include <limits> | ||
#include "AVThread_p.h" | ||
#include "QtAV/AVClock.h" | ||
#include "QtAV/AVDecoder.h" | ||
|
@@ -41,7 +42,6 @@ AVThreadPrivate::~AVThreadPrivate() { | |
next_pause = false; | ||
cond.wakeAll(); | ||
} | ||
ready_cond.wakeAll(); | ||
packets.setBlocking(true); //??? | ||
packets.clear(); | ||
QList<Filter*>::iterator it = filters.begin(); | ||
|
@@ -197,8 +197,6 @@ void AVThread::stop() | |
d.packets.setBlocking(false); //stop blocking take() | ||
d.packets.clear(); | ||
pause(false); | ||
QMutexLocker lock(&d.ready_mutex); | ||
d.ready = false; | ||
//terminate(); | ||
} | ||
|
||
|
@@ -305,9 +303,6 @@ void AVThread::resetState() | |
d.stop = false; | ||
d.packets.setBlocking(true); | ||
d.packets.clear(); | ||
QMutexLocker lock(&d.ready_mutex); | ||
d.ready = true; | ||
d.ready_cond.wakeOne(); | ||
} | ||
|
||
bool AVThread::tryPause(unsigned long timeout) | ||
|
@@ -341,12 +336,9 @@ void AVThread::setStatistics(Statistics *statistics) | |
d.statistics = statistics; | ||
} | ||
|
||
void AVThread::waitForReady() | ||
bool AVThread::waitForStarted(int msec) | ||
{ | ||
QMutexLocker lock(&d_func().ready_mutex); | ||
while (!d_func().ready) { | ||
d_func().ready_cond.wait(&d_func().ready_mutex); | ||
} | ||
return d_func().sem.tryAcquire(1, msec > 0 ? msec : std::numeric_limits<int>::max()); | ||
} | ||
|
||
void AVThread::waitAndCheck(ulong value, qreal pts) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -67,7 +67,7 @@ class AVThread : public QThread | |
|
||
bool isPaused() const; | ||
|
||
void waitForReady(); | ||
bool waitForStarted(int msec = -1); | ||
|
||
bool installFilter(Filter *filter, int index = 0x7FFFFFFF, bool lock = true); | ||
bool uninstallFilter(Filter *filter, bool lock = true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -75,6 +75,8 @@ void AudioThread::applyFilters(AudioFrame &frame) | |
void AudioThread::run() | ||
{ | ||
DPTR_D(AudioThread); | ||
AutoSem as(&d.sem); | ||
Q_UNUSED(as); | ||
//No decoder or output. No audio output is ok, just display picture | ||
if (!d.dec || !d.dec->isAvailable() || !d.outputSet) | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters