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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc

Issue 2272563010: AbsoluteSendTime rtp header extension publish MsTo24Bit conversion (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 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 | « webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h ('k') | no next file » | 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 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 19 matching lines...) Expand all
30 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 30 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
31 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 31 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 // | ID | len=2 | absolute send time | 32 // | ID | len=2 | absolute send time |
33 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 33 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 const char* AbsoluteSendTime::kName = 34 const char* AbsoluteSendTime::kName =
35 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; 35 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
36 bool AbsoluteSendTime::IsSupportedFor(MediaType type) { 36 bool AbsoluteSendTime::IsSupportedFor(MediaType type) {
37 return true; 37 return true;
38 } 38 }
39 39
40 bool AbsoluteSendTime::Parse(const uint8_t* data, uint32_t* value) { 40 bool AbsoluteSendTime::Parse(const uint8_t* data, uint32_t* time_24bits) {
41 *value = ByteReader<uint32_t, 3>::ReadBigEndian(data); 41 *time_24bits = ByteReader<uint32_t, 3>::ReadBigEndian(data);
42 return true; 42 return true;
43 } 43 }
44 44
45 bool AbsoluteSendTime::Write(uint8_t* data, int64_t time_ms) { 45 bool AbsoluteSendTime::Write(uint8_t* data, int64_t time_ms) {
46 const uint32_t kAbsSendTimeFraction = 18; 46 ByteWriter<uint32_t, 3>::WriteBigEndian(data, MsTo24Bits(time_ms));
47 uint32_t time_24_bits =
48 static_cast<uint32_t>(((time_ms << kAbsSendTimeFraction) + 500) / 1000) &
49 0x00FFFFFF;
50
51 ByteWriter<uint32_t, 3>::WriteBigEndian(data, time_24_bits);
52 return true; 47 return true;
53 } 48 }
54 49
55 // An RTP Header Extension for Client-to-Mixer Audio Level Indication 50 // An RTP Header Extension for Client-to-Mixer Audio Level Indication
56 // 51 //
57 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ 52 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
58 // 53 //
59 // The form of the audio level extension block: 54 // The form of the audio level extension block:
60 // 55 //
61 // 0 1 56 // 0 1
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 bool VideoOrientation::Parse(const uint8_t* data, uint8_t* value) { 189 bool VideoOrientation::Parse(const uint8_t* data, uint8_t* value) {
195 *value = data[0]; 190 *value = data[0];
196 return true; 191 return true;
197 } 192 }
198 193
199 bool VideoOrientation::Write(uint8_t* data, uint8_t value) { 194 bool VideoOrientation::Write(uint8_t* data, uint8_t value) {
200 data[0] = value; 195 data[0] = value;
201 return true; 196 return true;
202 } 197 }
203 } // namespace webrtc 198 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698