| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 12 #include "media/base/media_log_event.h" | 12 #include "media/base/media_log_event.h" |
| 13 #include "media/base/pipeline.h" | 13 #include "media/base/pipeline.h" |
| 14 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 18 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| 19 public: | 19 public: |
| 20 // Convert various enums to strings. | 20 // Convert various enums to strings. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); | 39 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); |
| 40 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); | 40 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); |
| 41 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( | 41 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( |
| 42 Pipeline::State state); | 42 Pipeline::State state); |
| 43 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); | 43 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); |
| 44 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( | 44 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( |
| 45 size_t width, size_t height); | 45 size_t width, size_t height); |
| 46 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( | 46 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( |
| 47 size_t start, size_t current, size_t end); | 47 size_t start, size_t current, size_t end); |
| 48 | 48 |
| 49 // Called when the pipeline statistics have been updated. | |
| 50 // This gets called every frame, so we send the most recent stats after 500ms. | |
| 51 // This function is NOT thread safe. | |
| 52 void QueueStatisticsUpdatedEvent(PipelineStatistics stats); | |
| 53 | |
| 54 protected: | 49 protected: |
| 55 friend class base::RefCountedThreadSafe<MediaLog>; | 50 friend class base::RefCountedThreadSafe<MediaLog>; |
| 56 virtual ~MediaLog(); | 51 virtual ~MediaLog(); |
| 57 | 52 |
| 58 private: | 53 private: |
| 59 // Actually add a STATISTICS_UPDATED event. | |
| 60 void AddStatisticsUpdatedEvent(); | |
| 61 | |
| 62 // A unique (to this process) id for this MediaLog. | 54 // A unique (to this process) id for this MediaLog. |
| 63 int32 id_; | 55 int32 id_; |
| 64 | 56 |
| 65 // The most recent set of pipeline stats. | |
| 66 PipelineStatistics last_statistics_; | |
| 67 bool stats_update_pending_; | |
| 68 base::Lock stats_lock_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 57 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
| 71 }; | 58 }; |
| 72 | 59 |
| 73 } // namespace media | 60 } // namespace media |
| 74 | 61 |
| 75 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 62 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
| OLD | NEW |