Abstract-Rate control for multimedia streaming has been the subject of many recent research activities and is crucial for peerto-peer networks, where controlling the rate at the source is ineffective. In this paper we propose a two-stage procedure for rate control. In particular, the first stage, based on Integer Linear Programming and a distortion model, optimally labels packets with a suitable priority level. This stage can be performed only once at the encoder. In a second stage, we derive an optimal strategy to choose prioritized packets for transmission, according to the available rate. This stage can be implemented at the transport level and autonomously by each peer. The techniques are specialized and used to control the rate of a standard H.264/SVC stream. We show by means of experiments that the proposed approach outperforms uncontrolled transmission, and that the proposed optimal priority selection gives substantial advantages over other simplified procedures.Index Terms-Peer-to-peer streaming, congestion control, H.264/AVC, scalable video coding.