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

Unified Diff: webrtc/base/timing.cc

Issue 1623543002: Refactor RtpSender and SSRCDatabase a bit. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove thread checker due to voe::ChannelOwner Created 4 years, 11 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
Index: webrtc/base/timing.cc
diff --git a/webrtc/base/timing.cc b/webrtc/base/timing.cc
index 0c5ed5e12cb71015f403ff8f8b7a45e5aec03237..7fdcf6e933fe2b0754f1da1d5b11eaeb96b4a847 100644
--- a/webrtc/base/timing.cc
+++ b/webrtc/base/timing.cc
@@ -21,30 +21,13 @@
#endif
#elif defined(WEBRTC_WIN)
#include <sys/timeb.h>
-#include "webrtc/base/win32.h"
#endif
namespace rtc {
-Timing::Timing() {
-#if defined(WEBRTC_WIN)
- // This may fail, but we handle failure gracefully in the methods
- // that use it (use alternative sleep method).
- //
- // TODO: Make it possible for user to tell if IdleWait will
- // be done at lesser resolution because of this.
- timer_handle_ = CreateWaitableTimer(NULL, // Security attributes.
- FALSE, // Manual reset?
- NULL); // Timer name.
-#endif
-}
+Timing::Timing() {}
-Timing::~Timing() {
-#if defined(WEBRTC_WIN)
- if (timer_handle_ != NULL)
- CloseHandle(timer_handle_);
-#endif
-}
+Timing::~Timing() {}
// static
double Timing::WallTimeNow() {
@@ -68,46 +51,4 @@ double Timing::TimerNow() {
return (static_cast<double>(TimeNanos()) / kNumNanosecsPerSec);
}
-double Timing::BusyWait(double period) {
- double start_time = TimerNow();
- while (TimerNow() - start_time < period) {
- }
- return TimerNow() - start_time;
-}
-
-double Timing::IdleWait(double period) {
- double start_time = TimerNow();
-
-#if defined(WEBRTC_POSIX)
- double sec_int, sec_frac = modf(period, &sec_int);
- struct timespec ts;
- ts.tv_sec = static_cast<time_t>(sec_int);
- ts.tv_nsec = static_cast<long>(sec_frac * 1.0e9); // NOLINT
-
- // NOTE(liulk): for the NOLINT above, long is the appropriate POSIX
- // type.
-
- // POSIX nanosleep may be interrupted by signals.
- while (nanosleep(&ts, &ts) == -1 && errno == EINTR) {
- }
-
-#elif defined(WEBRTC_WIN)
- if (timer_handle_ != NULL) {
- LARGE_INTEGER due_time;
-
- // Negative indicates relative time. The unit is 100 nanoseconds.
- due_time.QuadPart = -LONGLONG(period * 1.0e7);
-
- SetWaitableTimer(timer_handle_, &due_time, 0, NULL, NULL, TRUE);
- WaitForSingleObject(timer_handle_, INFINITE);
- } else {
- // Still attempts to sleep with lesser resolution.
- // The unit is in milliseconds.
- Sleep(DWORD(period * 1.0e3));
- }
-#endif
-
- return TimerNow() - start_time;
-}
-
} // namespace rtc

Powered by Google App Engine
This is Rietveld 408576698