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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_
6 #define CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_
10 #include "base/time/time.h"
11 #include "content/common/content_export.h"
12 #include "media/base/media_log.h"
15 class MessageLoopProxy
;
20 // RenderMediaLog is an implementation of MediaLog that forwards events to the
21 // browser process, throttling as necessary.
23 // To minimize the number of events sent over the wire, only the latest event
24 // added is sent for high frequency events (e.g., BUFFERED_EXTENTS_CHANGED).
25 class CONTENT_EXPORT RenderMediaLog
: public media::MediaLog
{
29 // MediaLog implementation.
30 void AddEvent(scoped_ptr
<media::MediaLogEvent
> event
) override
;
32 // Will reset |last_ipc_send_time_| with the value of NowTicks().
33 void SetTickClockForTesting(scoped_ptr
<base::TickClock
> tick_clock
);
36 ~RenderMediaLog() override
;
38 scoped_refptr
<base::MessageLoopProxy
> render_loop_
;
39 scoped_ptr
<base::TickClock
> tick_clock_
;
40 base::TimeTicks last_ipc_send_time_
;
41 std::vector
<media::MediaLogEvent
> queued_media_events_
;
43 // Limits the number buffered extents changed events we send over IPC to one.
44 scoped_ptr
<media::MediaLogEvent
> last_buffered_extents_changed_event_
;
46 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog
);
49 } // namespace content
51 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_