Refine: 优化rtsp相关代码

This commit is contained in:
ziyue
2022-01-12 15:21:33 +08:00
parent 5b6ff0af27
commit d52fc4c31f
4 changed files with 22 additions and 17 deletions

View File

@@ -419,7 +419,7 @@ void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) {
}
int RtspPusher::getTrackIndexByInterleaved(int interleaved) const {
for (int i = 0; i < (int)_track_vec.size(); ++i) {
for (size_t i = 0; i < _track_vec.size(); ++i) {
if (_track_vec[i]->_interleaved == interleaved) {
return i;
}
@@ -430,8 +430,8 @@ int RtspPusher::getTrackIndexByInterleaved(int interleaved) const {
throw SockException(Err_shutdown, StrPrinter << "no such track with interleaved:" << interleaved);
}
int RtspPusher::getTrackIndexByTrackType(TrackType type) const{
for (int i = 0; i < (int)_track_vec.size(); ++i) {
int RtspPusher::getTrackIndexByTrackType(TrackType type) const {
for (size_t i = 0; i < _track_vec.size(); ++i) {
if (type == _track_vec[i]->_type) {
return i;
}
@@ -439,7 +439,7 @@ int RtspPusher::getTrackIndexByTrackType(TrackType type) const{
if (_track_vec.size() == 1) {
return 0;
}
throw SockException(Err_shutdown, StrPrinter << "no such track with type:" << (int) type);
throw SockException(Err_shutdown, StrPrinter << "no such track with type:" << getTrackString(type));
}
void RtspPusher::sendRecord() {