If we only keep the active streams for the program just as we did before in the same order they are mentioned in the avprogram structure, we would only need to iterate over the list once.