void Pipeliner::fillUpPipeline(const ndn::Name& threadPrefix) { if (interestControl_->room() > 0) LogDebugC << interestControl_->room() << " sample(s) will be requested" << std::endl; while (interestControl_->room() > 0) { Name n = nameScheme_->samplePrefix(threadPrefix, nextSamplePriority_); n.appendSequenceNumber((nextSamplePriority_ == SampleClass::Delta ? seqCounter_.delta_ : seqCounter_.key_)); const std::vector<boost::shared_ptr<const Interest>> batch = getBatch(n, nextSamplePriority_); int64_t deadline = playbackQueue_->size()+playbackQueue_->pendingSize(); request(batch, DeadlinePriority::fromNow(deadline)); buffer_->requested(batch); interestControl_->increment(); LogDebugC << "requested " << (nextSamplePriority_ == SampleClass::Delta ? seqCounter_.delta_ : seqCounter_.key_) << " " << SAMPLE_SUFFIX(n) << " x" << batch.size() << std::endl; if (nextSamplePriority_ == SampleClass::Delta) seqCounter_.delta_++; else seqCounter_.key_++; (*sstorage_)[Indicator::RequestedNum]++; if (nextSamplePriority_ == SampleClass::Key) (*sstorage_)[Indicator::RequestedKeyNum]++; nextSamplePriority_ = SampleClass::Delta; } }
void postNotification(const Notification& notification) { Name dataName = m_prefix; dataName.appendSequenceNumber(m_sequenceNo); shared_ptr<Data> data = make_shared<Data>(dataName); data->setContent(notification.wireEncode()); data->setFreshnessPeriod(time::seconds(1)); m_keyChain.sign(*data); m_face.put(*data); ++m_sequenceNo; }
void Pipeliner::express(const ndn::Name& threadPrefix, bool placeInBuffer) { Name n = nameScheme_->samplePrefix(threadPrefix, nextSamplePriority_); n.appendSequenceNumber((nextSamplePriority_ == SampleClass::Delta ? seqCounter_.delta_ : seqCounter_.key_)); const std::vector<boost::shared_ptr<const Interest>> batch = getBatch(n, nextSamplePriority_); LogDebugC << "sample " << (nextSamplePriority_ == SampleClass::Delta ? seqCounter_.delta_ : seqCounter_.key_) << " " << SAMPLE_SUFFIX(n) << " batch size " << batch.size() << std::endl; request(batch, DeadlinePriority::fromNow(0)); if (placeInBuffer) buffer_->requested(batch); nextSamplePriority_ = SampleClass::Delta; }
Name NamespaceInfo::getSuffix(int filter) const { using namespace suffix_filter; Name suffix; if (filter) { if (filter&(Library^Stream)) suffix.append(Name(NameComponents::NameComponentApp)).appendVersion(apiVersion_); if (filter&(Stream^Thread)) { suffix.append((streamType_ == MediaStreamParams::MediaStreamType::MediaStreamTypeAudio ? NameComponents::NameComponentAudio : NameComponents::NameComponentVideo)).append(streamName_); if (threadName_ != "") suffix.appendTimestamp(streamTimestamp_); } if (filter&(Thread^Sample) && threadName_ != "") suffix.append(threadName_); if (isMeta_) { if ((filter&(Thread^Sample) && threadName_ != "") || filter&(Stream^Thread)) suffix.append(NameComponents::NameComponentMeta); } if (filter&(Thread^Sample) && threadName_ != "" && streamType_ == MediaStreamParams::MediaStreamType::MediaStreamTypeVideo && !isMeta_) suffix.append((class_ == SampleClass::Delta ? NameComponents::NameComponentDelta : NameComponents::NameComponentKey)); if (filter&(Sample^Segment)) { if (isMeta_) suffix.appendVersion(metaVersion_); else suffix.appendSequenceNumber(sampleNo_); } if (filter&(Segment) && hasSegNo_) { if (isParity_) suffix.append(NameComponents::NameComponentParity); suffix.appendSegment(segNo_); } } return suffix; }
void sendNextInterest() { if (this->shouldStop()) return; BOOST_ASSERT(m_lastSequenceNo != std::numeric_limits<uint64_t>::max());// overflow or missing initial reply Name nextName = m_prefix; nextName.appendSequenceNumber(m_lastSequenceNo + 1); shared_ptr<Interest> interest = make_shared<Interest>(nextName); interest->setInterestLifetime(getInterestLifetime()); m_lastInterestId = m_face.expressInterest(*interest, bind(&NotificationSubscriber<Notification>::afterReceiveData, this, _2), bind(&NotificationSubscriber<Notification>::afterReceiveNack, this, _2), bind(&NotificationSubscriber<Notification>::afterTimeout, this)); }