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

Side by Side Diff: media/cast/rtcp/rtcp_utility.cc

Issue 270493003: Cast: Deduplicate event types in cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « media/cast/rtcp/rtcp_unittest.cc ('k') | media/cast/rtcp/sender_rtcp_event_subscriber.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/rtcp/rtcp_utility.h" 5 #include "media/cast/rtcp/rtcp_utility.h"
6 6
7 #include "base/big_endian.h" 7 #include "base/big_endian.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/cast/transport/cast_transport_defines.h" 9 #include "media/cast/transport/cast_transport_defines.h"
10 10
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 big_endian_reader.ReadU32(&field_.dlrr.last_receiver_report); 1044 big_endian_reader.ReadU32(&field_.dlrr.last_receiver_report);
1045 big_endian_reader.ReadU32(&field_.dlrr.delay_last_receiver_report); 1045 big_endian_reader.ReadU32(&field_.dlrr.delay_last_receiver_report);
1046 1046
1047 rtcp_data_ += 12; 1047 rtcp_data_ += 12;
1048 1048
1049 number_of_blocks_--; 1049 number_of_blocks_--;
1050 field_type_ = kRtcpXrDlrrCode; 1050 field_type_ = kRtcpXrDlrrCode;
1051 return true; 1051 return true;
1052 } 1052 }
1053 1053
1054 // Converts a log event type to an integer value.
1055 // NOTE: We have only allocated 4 bits to represent the type of event over the
1056 // wire. Therefore, this function can only return values from 0 to 15.
1054 uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event) { 1057 uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event) {
1055 switch (event) { 1058 switch (event) {
1056 case kAudioAckSent: 1059 case FRAME_ACK_SENT:
1057 return 1; 1060 return 11;
1058 case kAudioPlayoutDelay: 1061 case FRAME_PLAYOUT:
1059 return 2; 1062 return 12;
1060 case kAudioFrameDecoded: 1063 case FRAME_DECODED:
1061 return 3; 1064 return 13;
1062 case kAudioPacketReceived: 1065 case PACKET_RECEIVED:
1063 return 4; 1066 return 14;
1064 case kVideoAckSent:
1065 return 5;
1066 case kVideoFrameDecoded:
1067 return 6;
1068 case kVideoRenderDelay:
1069 return 7;
1070 case kVideoPacketReceived:
1071 return 8;
1072 case kDuplicateAudioPacketReceived:
1073 return 9;
1074 case kDuplicateVideoPacketReceived:
1075 return 10;
1076 default: 1067 default:
1077 return 0; // Not an interesting event. 1068 return 0; // Not an interesting event.
1078 } 1069 }
1079 } 1070 }
1080 1071
1081 CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event) { 1072 CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event) {
1073 // TODO(imcheng): Remove the old mappings once they are no longer used.
1082 switch (event) { 1074 switch (event) {
1083 case 1: 1075 case 1: // AudioAckSent
1084 return media::cast::kAudioAckSent; 1076 case 5: // VideoAckSent
1085 case 2: 1077 case 11: // Unified
1086 return media::cast::kAudioPlayoutDelay; 1078 return FRAME_ACK_SENT;
1087 case 3: 1079 case 2: // AudioPlayoutDelay
1088 return media::cast::kAudioFrameDecoded; 1080 case 7: // VideoRenderDelay
1089 case 4: 1081 case 12: // Unified
1090 return media::cast::kAudioPacketReceived; 1082 return FRAME_PLAYOUT;
1091 case 5: 1083 case 3: // AudioFrameDecoded
1092 return media::cast::kVideoAckSent; 1084 case 6: // VideoFrameDecoded
1093 case 6: 1085 case 13: // Unified
1094 return media::cast::kVideoFrameDecoded; 1086 return FRAME_DECODED;
1095 case 7: 1087 case 4: // AudioPacketReceived
1096 return media::cast::kVideoRenderDelay; 1088 case 8: // VideoPacketReceived
1097 case 8: 1089 case 14: // Unified
1098 return media::cast::kVideoPacketReceived; 1090 return PACKET_RECEIVED;
1099 case 9: 1091 case 9: // DuplicateAudioPacketReceived
1100 return media::cast::kDuplicateAudioPacketReceived; 1092 case 10: // DuplicateVideoPacketReceived
1101 case 10:
1102 return media::cast::kDuplicateVideoPacketReceived;
1103 default: 1093 default:
1104 // If the sender adds new log messages we will end up here until we add 1094 // If the sender adds new log messages we will end up here until we add
1105 // the new messages in the receiver. 1095 // the new messages in the receiver.
1106 VLOG(1) << "Unexpected log message received: " << static_cast<int>(event); 1096 VLOG(1) << "Unexpected log message received: " << static_cast<int>(event);
1107 NOTREACHED(); 1097 NOTREACHED();
1108 return media::cast::kUnknown; 1098 return UNKNOWN;
1109 } 1099 }
1110 } 1100 }
1111 1101
1112 } // namespace cast 1102 } // namespace cast
1113 } // namespace media 1103 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/rtcp/rtcp_unittest.cc ('k') | media/cast/rtcp/sender_rtcp_event_subscriber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698