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

Unified Diff: content/renderer/media/webrtc_logging.cc

Issue 218403004: Fix the timestamp generation for webrtc native log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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: content/renderer/media/webrtc_logging.cc
diff --git a/content/renderer/media/webrtc_logging.cc b/content/renderer/media/webrtc_logging.cc
index 29cf5f50c9b1e6c1249e5662702c4f0c9c73d093..96868a6836cae1c1321a5c2363b170dd2d20a25d 100644
--- a/content/renderer/media/webrtc_logging.cc
+++ b/content/renderer/media/webrtc_logging.cc
@@ -4,9 +4,6 @@
#include "content/renderer/media/webrtc_logging.h"
-#include <iomanip>
-#include <sstream>
-
#include "base/time/time.h"
#include "content/public/renderer/webrtc_log_message_delegate.h"
#include "third_party/libjingle/overrides/talk/base/logging.h"
@@ -15,44 +12,22 @@ namespace content {
// Shall only be set once and never go back to NULL.
WebRtcLogMessageDelegate* g_webrtc_logging_delegate = NULL;
-uint64 g_started_time_ms_ = 0;
void InitWebRtcLoggingDelegate(WebRtcLogMessageDelegate* delegate) {
CHECK(!g_webrtc_logging_delegate);
CHECK(delegate);
g_webrtc_logging_delegate = delegate;
-
- g_started_time_ms_ = base::Time::Now().ToInternalValue() /
- base::Time::kMicrosecondsPerMillisecond;
-}
-
-void WebRtcLogMessageWithTimestamp(const std::string& message) {
- if (g_webrtc_logging_delegate)
- g_webrtc_logging_delegate->LogMessage(message);
}
void InitWebRtcLogging() {
- // Log messages from Libjingle should always have timestamps.
- talk_base::InitDiagnosticLoggingDelegateFunction(
- WebRtcLogMessageWithTimestamp);
+ // Log messages from Libjingle should not have timestamps.
+ talk_base::InitDiagnosticLoggingDelegateFunction(&WebRtcLogMessage);
}
void WebRtcLogMessage(const std::string& message) {
- // Keep consistent with talk_base::DiagnosticLogMessage::CreateTimestamp.
- // TODO(grunell): remove the duplicated code and unify the timestamp creation.
- uint64 now_us = base::Time::Now().ToInternalValue();
- uint64 interval_ms = now_us / base::Time::kMicrosecondsPerMillisecond -
- g_started_time_ms_;
-
- std::ostringstream message_oss;
- message_oss << "[" << std::setfill('0') << std::setw(3)
- << (interval_ms / 1000)
- << ":" << std::setw(3)
- << (interval_ms % 1000)
- << std::setfill(' ') << "] " << message;
-
- WebRtcLogMessageWithTimestamp(message_oss.str());
+ if (g_webrtc_logging_delegate)
+ g_webrtc_logging_delegate->LogMessage(message);
}
} // namespace content
« no previous file with comments | « chrome/renderer/media/webrtc_logging_message_filter.cc ('k') | third_party/libjingle/overrides/talk/base/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698