winlin

refine rtmp client, add comments for the dumps_packets()

@@ -212,8 +212,13 @@ int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, in @@ -212,8 +212,13 @@ int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, in
212 av_start_time = last->header.timestamp; 212 av_start_time = last->header.timestamp;
213 213
214 if (count == (int)msgs.size()) { 214 if (count == (int)msgs.size()) {
  215 + // the pmsgs is big enough and clear msgs at most time.
215 msgs.clear(); 216 msgs.clear();
216 } else { 217 } else {
  218 + // erase some vector elements may cause memory copy,
  219 + // maybe can use more efficient vector.swap to avoid copy.
  220 + // @remark for the pmsgs is big enough, for instance, SYS_MAX_PLAY_SEND_MSGS 128,
  221 + // the rtmp play client will get 128msgs once, so this branch rarely execute.
217 msgs.erase(msgs.begin(), msgs.begin() + count); 222 msgs.erase(msgs.begin(), msgs.begin() + count);
218 } 223 }
219 224