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

Side by Side Diff: media/base/media_log.h

Issue 1236543007: MSE: Log buffered audio splice generation to media-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
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 <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "media/base/media_export.h" 14 #include "media/base/media_export.h"
15 #include "media/base/media_log_event.h" 15 #include "media/base/media_log_event.h"
16 #include "media/base/pipeline.h" 16 #include "media/base/pipeline.h"
17 #include "media/base/pipeline_status.h" 17 #include "media/base/pipeline_status.h"
18 18
19 namespace media { 19 namespace media {
20 20
21 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { 21 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> {
22 public: 22 public:
23 enum MediaLogLevel { 23 enum MediaLogLevel {
24 MEDIALOG_ERROR, 24 MEDIALOG_ERROR,
25 MEDIALOG_INFO, 25 MEDIALOG_INFO,
26 MEDIALOG_DEBUG, 26 MEDIALOG_DEBUG,
27 }; 27 };
28 28
29 // Captures the parameter detail of a BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED
DaleCurtis 2015/07/14 23:37:47 Instead of adding a class for this, do we just wan
30 // MediaLogEvent.
31 class AudioSpliceStatistics {
32 public:
33 AudioSpliceStatistics();
34 AudioSpliceStatistics(int count,
35 int degenerate_count,
36 double total_duration,
DaleCurtis 2015/07/14 23:37:47 Why not TimeDelta for all these?
37 double min_duration,
38 double max_duration);
39
40 // Methods to update statistics.
41 void OnSplice(double duration);
42 void OnDegenerateSplice();
43
44 // Methods to retrieve statistics.
45 int count() const { return count_; }
46 int degenerate_count() const { return degenerate_count_; }
47 double AverageDuration() const;
48 double min_duration() const { return min_duration_; }
49 double max_duration() const { return max_duration_; }
50
51 private:
52 int count_;
53 int degenerate_count_;
54 double total_duration_;
55 double min_duration_;
56 double max_duration_;
57 };
58
29 // Convert various enums to strings. 59 // Convert various enums to strings.
30 static std::string MediaLogLevelToString(MediaLogLevel level); 60 static std::string MediaLogLevelToString(MediaLogLevel level);
31 static MediaLogEvent::Type MediaLogLevelToEventType(MediaLogLevel level); 61 static MediaLogEvent::Type MediaLogLevelToEventType(MediaLogLevel level);
32 static std::string EventTypeToString(MediaLogEvent::Type type); 62 static std::string EventTypeToString(MediaLogEvent::Type type);
33 static std::string PipelineStatusToString(PipelineStatus status); 63 static std::string PipelineStatusToString(PipelineStatus status);
34 64
35 static std::string MediaEventToLogString(const MediaLogEvent& event); 65 static std::string MediaEventToLogString(const MediaLogEvent& event);
36 66
37 MediaLog(); 67 MediaLog();
38 68
(...skipping 13 matching lines...) Expand all
52 base::TimeDelta value); 82 base::TimeDelta value);
53 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); 83 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url);
54 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); 84 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds);
55 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( 85 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent(
56 Pipeline::State state); 86 Pipeline::State state);
57 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); 87 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error);
58 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( 88 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent(
59 size_t width, size_t height); 89 size_t width, size_t height);
60 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( 90 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent(
61 int64 start, int64 current, int64 end); 91 int64 start, int64 current, int64 end);
92 scoped_ptr<MediaLogEvent> CreateBufferedSpliceStatisticsChangedEvent(
93 const AudioSpliceStatistics& statistics);
62 94
63 // Report a log message at the specified log level. 95 // Report a log message at the specified log level.
64 void AddLogEvent(MediaLogLevel level, const std::string& message); 96 void AddLogEvent(MediaLogLevel level, const std::string& message);
65 97
66 // Report a property change without an accompanying event. 98 // Report a property change without an accompanying event.
67 void SetStringProperty(const std::string& key, const std::string& value); 99 void SetStringProperty(const std::string& key, const std::string& value);
68 void SetIntegerProperty(const std::string& key, int value); 100 void SetIntegerProperty(const std::string& key, int value);
69 void SetDoubleProperty(const std::string& key, double value); 101 void SetDoubleProperty(const std::string& key, double value);
70 void SetBooleanProperty(const std::string& key, bool value); 102 void SetBooleanProperty(const std::string& key, bool value);
71 void SetTimeProperty(const std::string& key, base::TimeDelta value); 103 void SetTimeProperty(const std::string& key, base::TimeDelta value);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ 149 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \
118 LAZY_STREAM(MEDIA_LOG(level, media_log), \ 150 LAZY_STREAM(MEDIA_LOG(level, media_log), \
119 (count) < (max) && ((count)++ || true)) \ 151 (count) < (max) && ((count)++ || true)) \
120 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ 152 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \
121 "may be suppressed): " \ 153 "may be suppressed): " \
122 : "") 154 : "")
123 155
124 } // namespace media 156 } // namespace media
125 157
126 #endif // MEDIA_BASE_MEDIA_LOG_H_ 158 #endif // MEDIA_BASE_MEDIA_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698