Add method needed to extract frame capture and arrival timestamps from rtc event logs.

BUG=None

Review-Url: https://codereview.webrtc.org/2557073002
Cr-Commit-Position: refs/heads/master@{#15717}
This commit is contained in:
stefan
2016-12-20 08:51:52 -08:00
committed by Commit bot
parent f7969df2d9
commit 0838327ec9
2 changed files with 32 additions and 0 deletions

View File

@ -1167,5 +1167,33 @@ void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) {
plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin);
plot->SetTitle("Network Delay Change.");
}
std::vector<std::pair<int64_t, int64_t>> EventLogAnalyzer::GetFrameTimestamps()
const {
std::vector<std::pair<int64_t, int64_t>> timestamps;
size_t largest_stream_size = 0;
const std::vector<LoggedRtpPacket>* largest_video_stream = nullptr;
// Find the incoming video stream with the most number of packets that is
// not rtx.
for (const auto& kv : rtp_packets_) {
if (kv.first.GetDirection() == kIncomingPacket &&
video_ssrcs_.find(kv.first) != video_ssrcs_.end() &&
rtx_ssrcs_.find(kv.first) == rtx_ssrcs_.end() &&
kv.second.size() > largest_stream_size) {
largest_stream_size = kv.second.size();
largest_video_stream = &kv.second;
}
}
if (largest_video_stream == nullptr) {
for (auto& packet : *largest_video_stream) {
if (packet.header.markerBit) {
int64_t capture_ms = packet.header.timestamp / 90.0;
int64_t arrival_ms = packet.timestamp / 1000.0;
timestamps.push_back(std::make_pair(capture_ms, arrival_ms));
}
}
}
return timestamps;
}
} // namespace plotting
} // namespace webrtc

View File

@ -86,6 +86,10 @@ class EventLogAnalyzer {
void CreateNetworkDelayFeedbackGraph(Plot* plot);
// Returns a vector of capture and arrival timestamps for the video frames
// of the stream with the most number of frames.
std::vector<std::pair<int64_t, int64_t>> GetFrameTimestamps() const;
private:
class StreamId {
public: