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

Unified Diff: media/cast/rtcp/rtcp_receiver.cc

Issue 266373008: Cast: Fix rtcp event dedup logic in rtcp_receiver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | media/cast/rtcp/rtcp_receiver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/rtcp/rtcp_receiver.cc
diff --git a/media/cast/rtcp/rtcp_receiver.cc b/media/cast/rtcp/rtcp_receiver.cc
index 8c0e593d6e22a2c7332ad8aa2d8b309466901b15..f8d9df4b9e66d0d628194c3da3989b2c06dc1391 100644
--- a/media/cast/rtcp/rtcp_receiver.cc
+++ b/media/cast/rtcp/rtcp_receiver.cc
@@ -10,35 +10,11 @@
namespace {
-media::cast::CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event) {
- switch (event) {
- case 1:
- return media::cast::kAudioAckSent;
- case 2:
- return media::cast::kAudioPlayoutDelay;
- case 3:
- return media::cast::kAudioFrameDecoded;
- case 4:
- return media::cast::kAudioPacketReceived;
- case 5:
- return media::cast::kVideoAckSent;
- case 6:
- return media::cast::kVideoFrameDecoded;
- case 7:
- return media::cast::kVideoRenderDelay;
- case 8:
- return media::cast::kVideoPacketReceived;
- case 9:
- return media::cast::kDuplicateAudioPacketReceived;
- case 10:
- return media::cast::kDuplicateVideoPacketReceived;
- default:
- // If the sender adds new log messages we will end up here until we add
- // the new messages in the receiver.
- VLOG(1) << "Unexpected log message received: " << static_cast<int>(event);
- NOTREACHED();
- return media::cast::kUnknown;
- }
+bool IsRtcpPacketEvent(media::cast::CastLoggingEvent event_type) {
+ return event_type == media::cast::kAudioPacketReceived ||
+ event_type == media::cast::kVideoPacketReceived ||
+ event_type == media::cast::kDuplicateAudioPacketReceived ||
+ event_type == media::cast::kDuplicateVideoPacketReceived;
}
media::cast::transport::RtcpSenderFrameStatus
@@ -61,12 +37,16 @@ TranslateToFrameStatusFromWireFormat(uint8 status) {
}
}
-// A receiver event is identified by frame RTP timestamp, event timestamp and
-// event type.
+// A receiver frame event is identified by frame RTP timestamp, event timestamp
+// and event type.
+// A receiver packet event is identified by all of the above plus packet id.
size_t HashReceiverEvent(uint32 frame_rtp_timestamp,
Alpha Left Google 2014/05/06 20:55:52 I suggest we change the hash set to use a key of s
imcheng 2014/05/06 21:19:47 Are you suggesting that we get rid of the base::Ha
Alpha Left Google 2014/05/06 21:21:45 That's right. I used it because base::hash_map mig
imcheng 2014/05/06 22:29:39 Done.
const base::TimeTicks& event_timestamp,
- media::cast::CastLoggingEvent event_type) {
+ uint8 event_type,
+ uint16 packet_id_or_zero) {
uint64 value1 = event_type;
+ value1 <<= 16;
+ value1 |= packet_id_or_zero;
value1 <<= 32;
value1 |= frame_rtp_timestamp;
return base::HashInts64(
@@ -490,8 +470,10 @@ void RtcpReceiver::HandleApplicationSpecificCastReceiverEventLog(
RtcpReceiverEventLogMessages* event_log_messages) {
const RtcpField& rtcp_field = rtcp_parser->Field();
- const CastLoggingEvent event_type =
- TranslateToLogEventFromWireFormat(rtcp_field.cast_receiver_log.event);
+ const uint8 event = rtcp_field.cast_receiver_log.event;
+ const CastLoggingEvent event_type = TranslateToLogEventFromWireFormat(event);
+ uint16 packet_id = IsRtcpPacketEvent(event_type) ?
+ rtcp_field.cast_receiver_log.delay_delta_or_packet_id.packet_id : 0;
const base::TimeTicks event_timestamp =
base::TimeTicks() +
base::TimeDelta::FromMilliseconds(
@@ -506,7 +488,7 @@ void RtcpReceiver::HandleApplicationSpecificCastReceiverEventLog(
// Different events may have the same hash value. That's okay because full
// accuracy is not important in this case.
const size_t event_hash =
- HashReceiverEvent(frame_rtp_timestamp, event_timestamp, event_type);
+ HashReceiverEvent(frame_rtp_timestamp, event_timestamp, event, packet_id);
if (receiver_event_hash_set_.find(event_hash) !=
receiver_event_hash_set_.end()) {
return;
« no previous file with comments | « no previous file | media/cast/rtcp/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698