ns-allinone-2.35/rap/media-app.cc
int MediaSegmentList::evict_tail(int size)
{
	int sz = size, tz;
	MediaSegment *tmp = (MediaSegment *)tail_;
	while ((tmp != NULL) && (sz > 0)) {
		// Reduce the last segment's size and adjust its playout time
		tz = tmp->evict_tail(sz);
		length_ -= tz;
		sz -= tz; 
		if (tmp->datasize() == 0) {
			// This segment is empty now
			detach(tmp);
			delete tmp;
			tmp = (MediaSegment *)tail_;
		}
	}
	return size - sz;
}
// Note that evicting all segments in this layer may not leave enough 
// space, so we return the number of bytes evicted from this layer
Note that evicting all segments in this layer may not leave enough
space, so we return the number of bytes evicted from this layer
Note that evicting all segments in this layer may not leave enough space so we return the number of bytes evicted from this layer
int MediaSegmentList::evict_tail(int size)
{
	int sz = size, tz;
	MediaSegment *tmp = (MediaSegment *)tail_;
	while ((tmp != NULL) && (sz > 0)) {
		tz = tmp->evict_tail(sz);
		length_ -= tz;
		sz -= tz; 
		if (tmp->datasize() == 0) {
			detach(tmp);
			delete tmp;
			tmp = (MediaSegment *)tail_;
		}
	}
	return size - sz;
}
int MediaSegmentList :: evict_tail ( int size ) { int sz = size , tz ; MediaSegment * tmp = ( MediaSegment * ) tail_ ; while ( ( tmp != NULL ) && ( sz > 0 ) ) { tz = tmp -> evict_tail ( sz ) ; length_ -= tz ; sz -= tz ; if ( tmp -> datasize ( ) == 0 ) { detach ( tmp ) ; delete tmp ; tmp = ( MediaSegment * ) tail_ ; } } return size - sz ; }
Note that evicting all segments in this layer may not leave enough
space, so we return the number of bytes evicted from this layer
Note that evicting all segments in this layer may not leave enough space so we return the number of bytes evicted from this layer
// Reduce the last segment's size and adjust its playout time // This segment is empty now