| 244 | */ |
| 245 | |
| 246 | bool cOpenslesSource::notifyEmptyTickloop() { |
| 247 | smileMutexLock(threadMutex_); |
| 248 | bool threadStarted = threadStarted_; |
| 249 | smileMutexUnlock(threadMutex_); |
| 250 | // we must check threadStarted and NOT threadActive here, |
| 251 | // to avoid exiting when thread is just about starting |
| 252 | if (!threadStarted) { |
| 253 | return false; |
| 254 | } |
| 255 | smileCondTimedWait(threadCondition_, 1.000); |
| 256 | smileMutexLock(dataFlagMutex_); |
| 257 | if (dataFlag_) { |
| 258 | dataFlag_ = false; |
| 259 | smileMutexUnlock(dataFlagMutex_); |
| 260 | // return 1 (true) when data was received from audio device since last tick |
| 261 | return true; |
| 262 | } |
| 263 | smileMutexUnlock(dataFlagMutex_); |
| 264 | smileMutexLock(threadMutex_); |
| 265 | bool threadActive = threadActive_; |
| 266 | smileMutexUnlock(threadMutex_); |
| 267 | if (threadActive) { |
| 268 | return true; |
| 269 | } else { |
| 270 | // return false, when no data received for 1 second |
| 271 | return false; |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | eTickResult cOpenslesSource::myTick(long long t) |
| 276 | { |
no test coverage detected