ns-allinone-2.35/rap/media-app.cc
int MediaSegmentList::evict_head_offset(int offset)
{
	int sz = 0;
	MediaSegment *tmp = (MediaSegment *)head_;
	while ((tmp != NULL) && (tmp->start() < offset)) {
		if (tmp->end() <= offset) {
			// delete whole segment
			sz += tmp->datasize();
			length_ -= tmp->datasize();
			detach(tmp);
			delete tmp;
			tmp = (MediaSegment *)head_;
		} else {
			// remove part of the segment
			sz += offset - tmp->start();
			length_ -= offset - tmp->start();
			tmp->set_start(offset);
		}
	}
	if (head_ == NULL)
		tail_ = NULL;
	return sz;
}
// Evict all segments before <offset> from head and returns the size of 
// evicted segments.
Evict all segments before  from head and returns the size of
evicted segments.
Evict all segments before from head and returns the size of evicted segments .
int MediaSegmentList::evict_head_offset(int offset)
{
	int sz = 0;
	MediaSegment *tmp = (MediaSegment *)head_;
	while ((tmp != NULL) && (tmp->start() < offset)) {
		if (tmp->end() <= offset) {
			sz += tmp->datasize();
			length_ -= tmp->datasize();
			detach(tmp);
			delete tmp;
			tmp = (MediaSegment *)head_;
		} else {
			sz += offset - tmp->start();
			length_ -= offset - tmp->start();
			tmp->set_start(offset);
		}
	}
	if (head_ == NULL)
		tail_ = NULL;
	return sz;
}
int MediaSegmentList :: evict_head_offset ( int offset ) { int sz = 0 ; MediaSegment * tmp = ( MediaSegment * ) head_ ; while ( ( tmp != NULL ) && ( tmp -> start ( ) < offset ) ) { if ( tmp -> end ( ) <= offset ) { sz += tmp -> datasize ( ) ; length_ -= tmp -> datasize ( ) ; detach ( tmp ) ; delete tmp ; tmp = ( MediaSegment * ) head_ ; } else { sz += offset - tmp -> start ( ) ; length_ -= offset - tmp -> start ( ) ; tmp -> set_start ( offset ) ; } } if ( head_ == NULL ) tail_ = NULL ; return sz ; }
Evict all segments before <offset> from head and returns the size of
evicted segments.
Evict all segments before <offset > from head and returns the size of evicted segments .
// delete whole segment // remove part of the segment