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

Side by Side Diff: talk/app/webrtc/sctputils.cc

Issue 1404473005: Reland of Moving MediaStreamSignaling logic into PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Getting rid of unneeded RTC_DCHECK. Created 5 years, 2 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 | « talk/app/webrtc/sctputils.h ('k') | talk/app/webrtc/sctputils_unittest.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 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 30 matching lines...) Expand all
41 41
42 enum DataChannelOpenMessageChannelType { 42 enum DataChannelOpenMessageChannelType {
43 DCOMCT_ORDERED_RELIABLE = 0x00, 43 DCOMCT_ORDERED_RELIABLE = 0x00,
44 DCOMCT_ORDERED_PARTIAL_RTXS = 0x01, 44 DCOMCT_ORDERED_PARTIAL_RTXS = 0x01,
45 DCOMCT_ORDERED_PARTIAL_TIME = 0x02, 45 DCOMCT_ORDERED_PARTIAL_TIME = 0x02,
46 DCOMCT_UNORDERED_RELIABLE = 0x80, 46 DCOMCT_UNORDERED_RELIABLE = 0x80,
47 DCOMCT_UNORDERED_PARTIAL_RTXS = 0x81, 47 DCOMCT_UNORDERED_PARTIAL_RTXS = 0x81,
48 DCOMCT_UNORDERED_PARTIAL_TIME = 0x82, 48 DCOMCT_UNORDERED_PARTIAL_TIME = 0x82,
49 }; 49 };
50 50
51 bool IsOpenMessage(const rtc::Buffer& payload) {
52 // Format defined at
53 // http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04
54
55 rtc::ByteBuffer buffer(payload);
56 uint8_t message_type;
57 if (!buffer.ReadUInt8(&message_type)) {
58 LOG(LS_WARNING) << "Could not read OPEN message type.";
59 return false;
60 }
61 return message_type == DATA_CHANNEL_OPEN_MESSAGE_TYPE;
62 }
63
51 bool ParseDataChannelOpenMessage(const rtc::Buffer& payload, 64 bool ParseDataChannelOpenMessage(const rtc::Buffer& payload,
52 std::string* label, 65 std::string* label,
53 DataChannelInit* config) { 66 DataChannelInit* config) {
54 // Format defined at 67 // Format defined at
55 // http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04 68 // http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04
56 69
57 rtc::ByteBuffer buffer(payload); 70 rtc::ByteBuffer buffer(payload);
58 uint8_t message_type; 71 uint8_t message_type;
59 if (!buffer.ReadUInt8(&message_type)) { 72 if (!buffer.ReadUInt8(&message_type)) {
60 LOG(LS_WARNING) << "Could not read OPEN message type."; 73 LOG(LS_WARNING) << "Could not read OPEN message type.";
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 payload->SetData(buffer.Data(), buffer.Length()); 196 payload->SetData(buffer.Data(), buffer.Length());
184 return true; 197 return true;
185 } 198 }
186 199
187 void WriteDataChannelOpenAckMessage(rtc::Buffer* payload) { 200 void WriteDataChannelOpenAckMessage(rtc::Buffer* payload) {
188 rtc::ByteBuffer buffer(rtc::ByteBuffer::ORDER_NETWORK); 201 rtc::ByteBuffer buffer(rtc::ByteBuffer::ORDER_NETWORK);
189 buffer.WriteUInt8(DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE); 202 buffer.WriteUInt8(DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE);
190 payload->SetData(buffer.Data(), buffer.Length()); 203 payload->SetData(buffer.Data(), buffer.Length());
191 } 204 }
192 } // namespace webrtc 205 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/sctputils.h ('k') | talk/app/webrtc/sctputils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698