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

Side by Side Diff: webrtc/api/video/video_content_type.cc

Issue 3006333002: Fix code formating in api/video/video_content_type.* (Closed)
Patch Set: Created 3 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/api/video/video_content_type.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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 30 matching lines...) Expand all
41 41
42 static constexpr uint8_t kExperimentShift = 3; 42 static constexpr uint8_t kExperimentShift = 3;
43 static constexpr uint8_t kExperimentBitsSize = 3; 43 static constexpr uint8_t kExperimentBitsSize = 3;
44 static constexpr uint8_t kExperimentBitsMask = 44 static constexpr uint8_t kExperimentBitsMask =
45 ((1u << kExperimentBitsSize) - 1) << kExperimentShift; // 0b00111000 45 ((1u << kExperimentBitsSize) - 1) << kExperimentShift; // 0b00111000
46 46
47 static constexpr uint8_t kTotalBitsSize = 47 static constexpr uint8_t kTotalBitsSize =
48 kScreenshareBitsSize + kSimulcastBitsSize + kExperimentBitsSize; 48 kScreenshareBitsSize + kSimulcastBitsSize + kExperimentBitsSize;
49 } // namespace 49 } // namespace
50 50
51 bool SetExperimentId(VideoContentType* content_type, 51 bool SetExperimentId(VideoContentType* content_type, uint8_t experiment_id) {
52 uint8_t experiment_id) {
53 // Store in bits 2-4. 52 // Store in bits 2-4.
54 if (experiment_id >= (1 << kExperimentBitsSize)) 53 if (experiment_id >= (1 << kExperimentBitsSize))
55 return false; 54 return false;
56 *content_type = static_cast<VideoContentType>( 55 *content_type = static_cast<VideoContentType>(
57 (static_cast<uint8_t>(*content_type) & ~kExperimentBitsMask) | 56 (static_cast<uint8_t>(*content_type) & ~kExperimentBitsMask) |
58 ((experiment_id << kExperimentShift) & kExperimentBitsMask)); 57 ((experiment_id << kExperimentShift) & kExperimentBitsMask));
59 return true; 58 return true;
60 } 59 }
61 60
62 bool SetSimulcastId(VideoContentType* content_type, 61 bool SetSimulcastId(VideoContentType* content_type, uint8_t simulcast_id) {
63 uint8_t simulcast_id) {
64 // Store in bits 5-6. 62 // Store in bits 5-6.
65 if (simulcast_id >= (1 << kSimulcastBitsSize)) 63 if (simulcast_id >= (1 << kSimulcastBitsSize))
66 return false; 64 return false;
67 *content_type = static_cast<VideoContentType>( 65 *content_type = static_cast<VideoContentType>(
68 (static_cast<uint8_t>(*content_type) & ~kSimulcastBitsMask) | 66 (static_cast<uint8_t>(*content_type) & ~kSimulcastBitsMask) |
69 ((simulcast_id << kSimulcastShift) & kSimulcastBitsMask)); 67 ((simulcast_id << kSimulcastShift) & kSimulcastBitsMask));
70 return true; 68 return true;
71 } 69 }
72 70
73 uint8_t GetExperimentId( 71 uint8_t GetExperimentId(
(...skipping 15 matching lines...) Expand all
89 bool IsValidContentType(uint8_t value) { 87 bool IsValidContentType(uint8_t value) {
90 // Any 6-bit value is allowed. 88 // Any 6-bit value is allowed.
91 return value < (1 << kTotalBitsSize); 89 return value < (1 << kTotalBitsSize);
92 } 90 }
93 91
94 const char* ToString(const VideoContentType& content_type) { 92 const char* ToString(const VideoContentType& content_type) {
95 return IsScreenshare(content_type) ? "screen" : "realtime"; 93 return IsScreenshare(content_type) ? "screen" : "realtime";
96 } 94 }
97 } // namespace videocontenttypehelpers 95 } // namespace videocontenttypehelpers
98 } // namespace webrtc 96 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/video/video_content_type.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698