1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

RTC: Rename send_packets api.

This commit is contained in:
winlin 2020-05-21 17:00:40 +08:00
parent 9199e40fc1
commit aaffb8bbd7
2 changed files with 10 additions and 22 deletions

View file

@ -646,7 +646,7 @@ srs_error_t SrsRtcPlayer::cycle()
// Send-out all RTP packets and do cleanup.
// TODO: FIXME: Handle error.
send_messages(source, pkts, info);
send_packets(source, pkts, info);
for (int i = 0; i < msg_count; i++) {
SrsRtpPacket2* pkt = pkts[i];
@ -679,7 +679,7 @@ srs_error_t SrsRtcPlayer::cycle()
}
}
srs_error_t SrsRtcPlayer::send_messages(SrsRtcSource* source, const vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
srs_error_t SrsRtcPlayer::send_packets(SrsRtcSource* source, const vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
{
srs_error_t err = srs_success;
@ -689,22 +689,6 @@ srs_error_t SrsRtcPlayer::send_messages(SrsRtcSource* source, const vector<SrsRt
}
// Covert kernel messages to RTP packets.
if ((err = messages_to_packets(source, pkts, info)) != srs_success) {
return srs_error_wrap(err, "messages to packets");
}
// By default, we send packets by sendmmsg.
if ((err = send_packets(pkts, info)) != srs_success) {
return srs_error_wrap(err, "raw send");
}
return err;
}
srs_error_t SrsRtcPlayer::messages_to_packets(SrsRtcSource* source, const vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
{
srs_error_t err = srs_success;
for (int i = 0; i < (int)pkts.size(); i++) {
SrsRtpPacket2* pkt = pkts[i];
@ -736,10 +720,15 @@ srs_error_t SrsRtcPlayer::messages_to_packets(SrsRtcSource* source, const vector
pkt->header.set_payload_type(video_payload_type);
}
// By default, we send packets by sendmmsg.
if ((err = do_send_packets(pkts, info)) != srs_success) {
return srs_error_wrap(err, "raw send");
}
return err;
}
srs_error_t SrsRtcPlayer::send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
srs_error_t SrsRtcPlayer::do_send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
{
srs_error_t err = srs_success;

View file

@ -230,9 +230,8 @@ public:
public:
virtual srs_error_t cycle();
private:
srs_error_t send_messages(SrsRtcSource* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
srs_error_t messages_to_packets(SrsRtcSource* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
srs_error_t send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
srs_error_t send_packets(SrsRtcSource* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
srs_error_t do_send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
public:
void nack_fetch(std::vector<SrsRtpPacket2*>& pkts, uint32_t ssrc, uint16_t seq);
void simulate_nack_drop(int nn);