OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ | 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ |
6 #define MEDIA_BASE_MEDIA_LOG_H_ | 6 #define MEDIA_BASE_MEDIA_LOG_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <sstream> | 11 #include <sstream> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
19 #include "media/base/media_log_event.h" | 19 #include "media/base/media_log_event.h" |
20 #include "media/base/pipeline.h" | 20 #include "media/base/pipeline_impl.h" |
21 #include "media/base/pipeline_status.h" | 21 #include "media/base/pipeline_status.h" |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 | 24 |
25 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 25 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
26 public: | 26 public: |
27 enum MediaLogLevel { | 27 enum MediaLogLevel { |
28 MEDIALOG_ERROR, | 28 MEDIALOG_ERROR, |
29 MEDIALOG_INFO, | 29 MEDIALOG_INFO, |
30 MEDIALOG_DEBUG, | 30 MEDIALOG_DEBUG, |
(...skipping 19 matching lines...) Expand all Loading... |
50 MediaLogEvent::Type type, const std::string& property, bool value); | 50 MediaLogEvent::Type type, const std::string& property, bool value); |
51 scoped_ptr<MediaLogEvent> CreateStringEvent(MediaLogEvent::Type type, | 51 scoped_ptr<MediaLogEvent> CreateStringEvent(MediaLogEvent::Type type, |
52 const std::string& property, | 52 const std::string& property, |
53 const std::string& value); | 53 const std::string& value); |
54 scoped_ptr<MediaLogEvent> CreateTimeEvent(MediaLogEvent::Type type, | 54 scoped_ptr<MediaLogEvent> CreateTimeEvent(MediaLogEvent::Type type, |
55 const std::string& property, | 55 const std::string& property, |
56 base::TimeDelta value); | 56 base::TimeDelta value); |
57 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); | 57 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); |
58 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); | 58 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); |
59 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( | 59 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( |
60 Pipeline::State state); | 60 PipelineImpl::State state); |
61 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); | 61 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); |
62 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( | 62 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( |
63 size_t width, size_t height); | 63 size_t width, size_t height); |
64 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent(int64_t start, | 64 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent(int64_t start, |
65 int64_t current, | 65 int64_t current, |
66 int64_t end); | 66 int64_t end); |
67 | 67 |
68 // Report a log message at the specified log level. | 68 // Report a log message at the specified log level. |
69 void AddLogEvent(MediaLogLevel level, const std::string& message); | 69 void AddLogEvent(MediaLogLevel level, const std::string& message); |
70 | 70 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ | 122 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ |
123 LAZY_STREAM(MEDIA_LOG(level, media_log), \ | 123 LAZY_STREAM(MEDIA_LOG(level, media_log), \ |
124 (count) < (max) && ((count)++ || true)) \ | 124 (count) < (max) && ((count)++ || true)) \ |
125 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ | 125 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ |
126 "may be suppressed): " \ | 126 "may be suppressed): " \ |
127 : "") | 127 : "") |
128 | 128 |
129 } // namespace media | 129 } // namespace media |
130 | 130 |
131 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 131 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |