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

Unified Diff: webrtc/call/call.h

Issue 2924393002: Move MinPositive to call.h (Closed)
Patch Set: Rebase Created 3 years, 6 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 | webrtc/call/call.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/call.h
diff --git a/webrtc/call/call.h b/webrtc/call/call.h
index 06479890ce151c4d8b667d489aaf7dff2f87e0be..5aa0836fa19ca011563ee0141f2af6d91d92cf0f 100644
--- a/webrtc/call/call.h
+++ b/webrtc/call/call.h
@@ -10,6 +10,7 @@
#ifndef WEBRTC_CALL_CALL_H_
#define WEBRTC_CALL_CALL_H_
+#include <algorithm>
#include <memory>
#include <string>
#include <vector>
@@ -39,6 +40,19 @@ enum class MediaType {
DATA
};
+// Like std::min, but considers non-positive values to be unset.
+// TODO(zstein): Remove once all callers use rtc::Optional.
+template <typename T>
+static T MinPositive(T a, T b) {
+ if (a <= 0) {
+ return b;
+ }
+ if (b <= 0) {
+ return a;
+ }
+ return std::min(a, b);
+}
+
class PacketReceiver {
public:
enum DeliveryStatus {
« no previous file with comments | « no previous file | webrtc/call/call.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698