diff --git a/webrtc/tools/event_log_visualizer/analyzer.cc b/webrtc/tools/event_log_visualizer/analyzer.cc index b57f89e73f..89e516a950 100644 --- a/webrtc/tools/event_log_visualizer/analyzer.cc +++ b/webrtc/tools/event_log_visualizer/analyzer.cc @@ -1167,5 +1167,33 @@ void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); plot->SetTitle("Network Delay Change."); } + +std::vector> EventLogAnalyzer::GetFrameTimestamps() + const { + std::vector> timestamps; + size_t largest_stream_size = 0; + const std::vector* 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 diff --git a/webrtc/tools/event_log_visualizer/analyzer.h b/webrtc/tools/event_log_visualizer/analyzer.h index 5cbcf79b8a..1a82dccad3 100644 --- a/webrtc/tools/event_log_visualizer/analyzer.h +++ b/webrtc/tools/event_log_visualizer/analyzer.h @@ -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> GetFrameTimestamps() const; + private: class StreamId { public: