Only use GetAudio events that correspond to an ssrc matching at least one incoming packet.
Using GetAudio events from SSRCs without incoming packets doesn't make sense, and should be prevented. Bug: b/116685514 Change-Id: I48e38bb780549c71cb5f68d370a6819634ad487d Reviewed-on: https://webrtc-review.googlesource.com/c/114321 Commit-Queue: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26017}
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "logging/rtc_event_log/rtc_event_processor.h"
|
||||
@ -73,23 +74,30 @@ bool RtcEventLogSource::OpenFile(const std::string& file_name,
|
||||
? std::numeric_limits<int64_t>::max()
|
||||
: parsed_log.stop_log_events().front().log_time_us();
|
||||
|
||||
std::set<uint32_t> packet_ssrcs;
|
||||
auto handle_rtp_packet =
|
||||
[this,
|
||||
first_log_end_time_us](const webrtc::LoggedRtpPacketIncoming& incoming) {
|
||||
[this, first_log_end_time_us,
|
||||
&packet_ssrcs](const webrtc::LoggedRtpPacketIncoming& incoming) {
|
||||
if (!filter_.test(incoming.rtp.header.payloadType) &&
|
||||
incoming.log_time_us() < first_log_end_time_us) {
|
||||
rtp_packets_.emplace_back(absl::make_unique<Packet>(
|
||||
incoming.rtp.header, incoming.rtp.total_length,
|
||||
incoming.rtp.total_length - incoming.rtp.header_length,
|
||||
static_cast<double>(incoming.log_time_ms())));
|
||||
packet_ssrcs.insert(rtp_packets_.back()->header().ssrc);
|
||||
}
|
||||
};
|
||||
|
||||
std::set<uint32_t> ignored_ssrcs;
|
||||
auto handle_audio_playout =
|
||||
[this, first_log_end_time_us](
|
||||
const webrtc::LoggedAudioPlayoutEvent& audio_playout) {
|
||||
[this, first_log_end_time_us, &packet_ssrcs,
|
||||
&ignored_ssrcs](const webrtc::LoggedAudioPlayoutEvent& audio_playout) {
|
||||
if (audio_playout.log_time_us() < first_log_end_time_us) {
|
||||
audio_outputs_.emplace_back(audio_playout.log_time_ms());
|
||||
if (packet_ssrcs.count(audio_playout.ssrc) > 0) {
|
||||
audio_outputs_.emplace_back(audio_playout.log_time_ms());
|
||||
} else {
|
||||
ignored_ssrcs.insert(audio_playout.ssrc);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -121,6 +129,12 @@ bool RtcEventLogSource::OpenFile(const std::string& file_name,
|
||||
// Fills in rtp_packets_ and audio_outputs_.
|
||||
event_processor.ProcessEventsInOrder();
|
||||
|
||||
for (const auto& ssrc : ignored_ssrcs) {
|
||||
std::cout << "Ignoring GetAudio events from SSRC 0x" << std::hex << ssrc
|
||||
<< " because no packets were found with a matching SSRC."
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user