void AMRDeinterleaver::doGetNextFrame() { // First, try getting a frame from the deinterleaving buffer: if (fDeinterleavingBuffer->retrieveFrame(fTo, fMaxSize, fFrameSize, fNumTruncatedBytes, fLastFrameHeader, fPresentationTime, fInputSource->isSynchronized())) { // Success! fNeedAFrame = False; fDurationInMicroseconds = uSecsPerFrame; // Call our own 'after getting' function. Because we're not a 'leaf' // source, we can call this directly, without risking // infinite recursion afterGetting(this); return; } // No luck, so ask our source for help: fNeedAFrame = True; if (!fInputSource->isCurrentlyAwaitingData()) { fInputSource->getNextFrame(fDeinterleavingBuffer->inputBuffer(), fDeinterleavingBuffer->inputBufferSize(), afterGettingFrame, this, FramedSource::handleClosure, this); } }
std::string Server::getStatsDocument() const { std::ostringstream doc; doc << "clear();" << std::endl; for (auto it = _connections.begin(); it != _connections.end(); ++it) { doc << "connection({"; auto connection = it->first; jsonKeyPairToStream(doc, "since", EpochTimeAsLocal(it->second), "fd", connection->getFd(), "id", reinterpret_cast<uint64_t>(connection), "uri", connection->getRequestUri(), "addr", formatAddress(connection->getRemoteAddress()), "user", connection->credentials() ? connection->credentials()->username : "******", "input", connection->inputBufferSize(), "read", connection->bytesReceived(), "output", connection->outputBufferSize(), "written", connection->bytesSent() ); doc << "});" << std::endl; } return doc.str(); }
unsigned char* AMRDeinterleavingBuffer::createNewBuffer() { return new unsigned char[inputBufferSize()]; }