Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(723)

Unified Diff: media/cast/logging/logging_raw.cc

Issue 136903003: cast: Wire upp logging to be sent over RTCP between receiver and sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge TOT Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/logging/logging_raw.h ('k') | media/cast/logging/logging_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/logging/logging_raw.cc
diff --git a/media/cast/logging/logging_raw.cc b/media/cast/logging/logging_raw.cc
index 3cc668dea70de430a9f1038d414b9bcd5a62dce8..626b330cd24896419a8fbe8a1f143336c12c0181 100644
--- a/media/cast/logging/logging_raw.cc
+++ b/media/cast/logging/logging_raw.cc
@@ -11,8 +11,9 @@
namespace media {
namespace cast {
-LoggingRaw::LoggingRaw()
- : frame_map_(),
+LoggingRaw::LoggingRaw(bool is_sender)
+ : is_sender_(is_sender),
+ frame_map_(),
packet_map_(),
generic_map_(),
weak_factory_(this) {}
@@ -24,6 +25,8 @@ void LoggingRaw::InsertFrameEvent(const base::TimeTicks& time_of_event,
uint32 rtp_timestamp,
uint32 frame_id) {
InsertBaseFrameEvent(time_of_event, event, frame_id, rtp_timestamp);
+
+ InsertRtcpFrameEvent(time_of_event, event, rtp_timestamp, base::TimeDelta());
}
void LoggingRaw::InsertFrameEventWithSize(const base::TimeTicks& time_of_event,
@@ -48,6 +51,8 @@ void LoggingRaw::InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
FrameRawMap::iterator it = frame_map_.find(rtp_timestamp);
DCHECK(it != frame_map_.end());
it->second.delay_delta = delay;
+
+ InsertRtcpFrameEvent(time_of_event, event, rtp_timestamp, delay);
}
void LoggingRaw::InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
@@ -108,6 +113,19 @@ void LoggingRaw::InsertPacketEvent(const base::TimeTicks& time_of_event,
packet_it->second.type.push_back(event);
}
}
+ if (event == kAudioPacketReceived) {
+ ReceiverRtcpEvent rtcp_event;
+ rtcp_event.type = event;
+ rtcp_event.timestamp = time_of_event;
+ rtcp_event.packet_id = packet_id;
+ audio_rtcp_map_.insert(std::make_pair(rtp_timestamp, rtcp_event));
+ } else if (event == kVideoPacketReceived) {
+ ReceiverRtcpEvent rtcp_event;
+ rtcp_event.type = event;
+ rtcp_event.timestamp = time_of_event;
+ rtcp_event.packet_id = packet_id;
+ video_rtcp_map_.insert(std::make_pair(rtp_timestamp, rtcp_event));
+ }
}
void LoggingRaw::InsertGenericEvent(const base::TimeTicks& time_of_event,
@@ -127,6 +145,61 @@ void LoggingRaw::InsertGenericEvent(const base::TimeTicks& time_of_event,
}
}
+void LoggingRaw::InsertRtcpFrameEvent(const base::TimeTicks& time_of_event,
+ CastLoggingEvent event,
+ uint32 rtp_timestamp,
+ base::TimeDelta delay) {
+ ReceiverRtcpEvent rtcp_event;
+ if (is_sender_) {
+ if (event != kVideoFrameCaptured &&
+ event != kVideoFrameSentToEncoder &&
+ event != kVideoFrameEncoded) {
+ // Not interested in other events.
+ return;
+ }
+ VideoRtcpRawMap::iterator it = video_rtcp_map_.find(rtp_timestamp);
+ if (it == video_rtcp_map_.end()) {
+ // We have not stored this frame (RTP timestamp) in our map.
+ rtcp_event.type = event;
+ video_rtcp_map_.insert(std::make_pair(rtp_timestamp, rtcp_event));
+ } else {
+ // We already have this frame (RTP timestamp) in our map.
+ // Only update events that are later in the chain.
+ // This is due to that events can be reordered on the wire.
+ if (event == kVideoFrameCaptured) {
+ return; // First event in chain can not be late by definition.
+ }
+ if (it->second.type == kVideoFrameEncoded) {
+ return; // Last event in chain should not be updated.
+ }
+ // Update existing entry.
+ it->second.type = event;
+ }
+ } else {
+ // We are a cast receiver.
+ switch (event) {
+ case kAudioPlayoutDelay:
+ rtcp_event.delay_delta = delay;
+ case kAudioFrameDecoded:
+ case kAudioAckSent:
+ rtcp_event.type = event;
+ rtcp_event.timestamp = time_of_event;
+ audio_rtcp_map_.insert(std::make_pair(rtp_timestamp, rtcp_event));
+ break;
+ case kVideoRenderDelay:
+ rtcp_event.delay_delta = delay;
+ case kVideoFrameDecoded:
+ case kVideoAckSent:
+ rtcp_event.type = event;
+ rtcp_event.timestamp = time_of_event;
+ video_rtcp_map_.insert(std::make_pair(rtp_timestamp, rtcp_event));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
FrameRawMap LoggingRaw::GetFrameData() const {
return frame_map_;
}
@@ -139,6 +212,18 @@ GenericRawMap LoggingRaw::GetGenericData() const {
return generic_map_;
}
+AudioRtcpRawMap LoggingRaw::GetAndResetAudioRtcpData() {
+ AudioRtcpRawMap return_map;
+ audio_rtcp_map_.swap(return_map);
+ return return_map;
+}
+
+VideoRtcpRawMap LoggingRaw::GetAndResetVideoRtcpData() {
+ VideoRtcpRawMap return_map;
+ video_rtcp_map_.swap(return_map);
+ return return_map;
+}
+
void LoggingRaw::Reset() {
frame_map_.clear();
packet_map_.clear();
« no previous file with comments | « media/cast/logging/logging_raw.h ('k') | media/cast/logging/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698