int queueTest(int argc, char* argv[]) { debug = TRUE; char buff[32]; Queue newQueue; initQueue(&newQueue); int i; for(i = 1; i < 10; i++) { int id = i; int priority = 5; //rand() % 100; sprintf(buff, "task %d, priority %d", id, priority); enqueue(id , &newQueue); dumpQueue(&newQueue); } printf("\nInitial Queue:"); dumpQueue(&newQueue); for(i = 0; i < 10; i--) { sprintf(buff, "\n Removing taskid %d...", i); takeout(i, &newQueue); printf(buff); dumpQueue(&newQueue); } debug = FALSE; return 0; }
void NuPlayer::Renderer::onFlush(const sp<AMessage> &msg) { int32_t audio; CHECK(msg->findInt32("audio", &audio)); // If we're currently syncing the queues, i.e. dropping audio while // aligning the first audio/video buffer times and only one of the // two queues has data, we may starve that queue by not requesting // more buffers from the decoder. If the other source then encounters // a discontinuity that leads to flushing, we'll never find the // corresponding discontinuity on the other queue. // Therefore we'll stop syncing the queues if at least one of them // is flushed. syncQueuesDone(); ALOGV("flushing %s", audio ? "audio" : "video"); if (audio) { #ifndef ANDROID_DEFAULT_CODE //@debug dumpQueue(&mAudioQueue, audio); mHasAudio = false; #endif flushQueue(&mAudioQueue); #ifndef ANDROID_DEFAULT_CODE mAudioSink->pause(); mAudioSink->flush(); mNumFramesWritten = 0; mAudioSink->start(); #endif Mutex::Autolock autoLock(mFlushLock); mFlushingAudio = false; mDrainAudioQueuePending = false; ++mAudioQueueGeneration; prepareForMediaRenderingStart(); } else { #ifndef ANDROID_DEFAULT_CODE //@debug dumpQueue(&mVideoQueue, audio); mHasVideo = false; #endif flushQueue(&mVideoQueue); Mutex::Autolock autoLock(mFlushLock); mFlushingVideo = false; mDrainVideoQueuePending = false; ++mVideoQueueGeneration; prepareForMediaRenderingStart(); } notifyFlushComplete(audio); }
void NuPlayer::Renderer::signalTimeDiscontinuity() { #ifndef ANDROID_DEFAULT_CODE if (!mAudioQueue.empty()) { ALOGE("------signalTimeDiscontinuity (audio size=%d)----", (int)mAudioQueue.size()); dumpQueue(&mAudioQueue, true); ALOGE("-----------------------------"); } if (!mVideoQueue.empty()) { ALOGE("------signalTimeDiscontinuity (video size=%d)----", (int)mVideoQueue.size()); dumpQueue(&mVideoQueue, false); ALOGE("-----------------------------"); } #endif // CHECK(mAudioQueue.empty()); // CHECK(mVideoQueue.empty()); mAnchorTimeMediaUs = -1; mAnchorTimeRealUs = -1; mSyncQueues = false; }
int recalculateTimeCommand(int argc, char* argv[]) { scheduler_mode = TIME_SLICE; recalculateTime(); reorganizeQueue(&READY_QUEUE); dumpQueue(&READY_QUEUE); scheduler_mode = ROUND_ROBIN; reorganizeQueue(&READY_QUEUE); return 0; }
void main(void) { int i; MyNode *n; cout << "Memory at start: " << coreleft() << " bytes\n"; // Create a queue of 10 nodes. for (i = 0; i < 10; i++) { n = new MyNode(i); q.put(n); } cout << "Memory after creating queue: " << coreleft() << " bytes\n"; dumpQueue(q); // Kill the queue and display it q.empty(); dumpQueue(q); // Create a queue of 10 nodes. for (i = 0; i < 10; i++) { n = new MyNode(i); q.put(n); } dumpQueue(q); // Remove all the nodes from the queue with get() while ((n = q.get()) != NULL) { cout << "Removed " << n->id() << endl; delete n; } dumpQueue(q); cout << "Memory at end: " << coreleft() << " bytes\n"; }
/** * checks overflow on queue - if so dump to the recoveryLog * **/ void straightQueue::checkQueueOverflow() { if( bRecoveryProcess ) return; // allow the queue to take all the events for recovery if( listSize >= maxQueueLength ) dumpQueue( "overflow" ); } // checkQueueOverflow