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

Side by Side Diff: content/renderer/media/webmediaplayer_ms_compositor.h

Issue 2770253004: Log out-of-order frames in chrome://media-internals. (Closed)
Patch Set: Include timestamps in the log. Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
17 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
18 #include "cc/layers/video_frame_provider.h" 19 #include "cc/layers/video_frame_provider.h"
19 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
20 21
21 namespace base { 22 namespace base {
22 class SingleThreadTaskRunner; 23 class SingleThreadTaskRunner;
23 } 24 }
24 25
25 namespace blink { 26 namespace blink {
26 class WebMediaStream; 27 class WebMediaStream;
27 } 28 }
28 29
29 namespace gfx { 30 namespace gfx {
30 class Size; 31 class Size;
31 } 32 }
32 33
33 namespace media { 34 namespace media {
35 class MediaLog;
34 class VideoRendererAlgorithm; 36 class VideoRendererAlgorithm;
35 } 37 }
36 38
37 namespace content { 39 namespace content {
38 class WebMediaPlayerMS; 40 class WebMediaPlayerMS;
39 41
40 // This class is designed to handle the work load on compositor thread for 42 // This class is designed to handle the work load on compositor thread for
41 // WebMediaPlayerMS. It will be instantiated on the main thread, but destroyed 43 // WebMediaPlayerMS. It will be instantiated on the main thread, but destroyed
42 // on the thread holding the last reference. 44 // on the thread holding the last reference.
43 // 45 //
44 // WebMediaPlayerMSCompositor utilizes VideoRendererAlgorithm to store the 46 // WebMediaPlayerMSCompositor utilizes VideoRendererAlgorithm to store the
45 // incoming frames and select the best frame for rendering to maximize the 47 // incoming frames and select the best frame for rendering to maximize the
46 // smoothness, if REFERENCE_TIMEs are populated for incoming VideoFrames. 48 // smoothness, if REFERENCE_TIMEs are populated for incoming VideoFrames.
47 // Otherwise, WebMediaPlayerMSCompositor will simply store the most recent 49 // Otherwise, WebMediaPlayerMSCompositor will simply store the most recent
48 // frame, and submit it whenever asked by the compositor. 50 // frame, and submit it whenever asked by the compositor.
49 class CONTENT_EXPORT WebMediaPlayerMSCompositor 51 class CONTENT_EXPORT WebMediaPlayerMSCompositor
50 : public NON_EXPORTED_BASE(cc::VideoFrameProvider), 52 : public NON_EXPORTED_BASE(cc::VideoFrameProvider),
51 public base::RefCountedThreadSafe<WebMediaPlayerMSCompositor> { 53 public base::RefCountedThreadSafe<WebMediaPlayerMSCompositor> {
52 public: 54 public:
53 // This |url| represents the media stream we are rendering. |url| is used to 55 // This |url| represents the media stream we are rendering. |url| is used to
54 // find out what web stream this WebMediaPlayerMSCompositor is playing, and 56 // find out what web stream this WebMediaPlayerMSCompositor is playing, and
55 // together with flag "--disable-rtc-smoothness-algorithm" determine whether 57 // together with flag "--disable-rtc-smoothness-algorithm" determine whether
56 // we enable algorithm or not. 58 // we enable algorithm or not.
57 WebMediaPlayerMSCompositor( 59 WebMediaPlayerMSCompositor(
58 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, 60 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
59 const blink::WebMediaStream& web_stream, 61 const blink::WebMediaStream& web_stream,
60 const base::WeakPtr<WebMediaPlayerMS>& player); 62 const base::WeakPtr<WebMediaPlayerMS>& player,
63 scoped_refptr<media::MediaLog> media_log_);
61 64
62 void EnqueueFrame(scoped_refptr<media::VideoFrame> frame); 65 void EnqueueFrame(scoped_refptr<media::VideoFrame> frame);
63 66
64 // Statistical data 67 // Statistical data
65 gfx::Size GetCurrentSize(); 68 gfx::Size GetCurrentSize();
66 base::TimeDelta GetCurrentTime(); 69 base::TimeDelta GetCurrentTime();
67 size_t total_frame_count(); 70 size_t total_frame_count();
68 size_t dropped_frame_count(); 71 size_t dropped_frame_count();
69 72
70 // VideoFrameProvider implementation. 73 // VideoFrameProvider implementation.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 118
116 // Used for DCHECKs to ensure method calls executed in the correct thread. 119 // Used for DCHECKs to ensure method calls executed in the correct thread.
117 base::ThreadChecker thread_checker_; 120 base::ThreadChecker thread_checker_;
118 base::ThreadChecker io_thread_checker_; 121 base::ThreadChecker io_thread_checker_;
119 122
120 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 123 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
121 base::MessageLoop* main_message_loop_; 124 base::MessageLoop* main_message_loop_;
122 125
123 base::WeakPtr<WebMediaPlayerMS> player_; 126 base::WeakPtr<WebMediaPlayerMS> player_;
124 127
128 scoped_refptr<media::MediaLog> media_log_;
129
125 size_t serial_; 130 size_t serial_;
126 131
127 // A pointer back to the compositor to inform it about state changes. This 132 // A pointer back to the compositor to inform it about state changes. This
128 // is not |nullptr| while the compositor is actively using this 133 // is not |nullptr| while the compositor is actively using this
129 // VideoFrameProvider. This will be set to |nullptr| when the compositor stops 134 // VideoFrameProvider. This will be set to |nullptr| when the compositor stops
130 // serving this VideoFrameProvider. 135 // serving this VideoFrameProvider.
131 cc::VideoFrameProvider::Client* video_frame_provider_client_; 136 cc::VideoFrameProvider::Client* video_frame_provider_client_;
132 137
133 // |current_frame_| is updated only on compositor thread. The object it 138 // |current_frame_| is updated only on compositor thread. The object it
134 // holds can be freed on the compositor thread if it is the last to hold a 139 // holds can be freed on the compositor thread if it is the last to hold a
(...skipping 26 matching lines...) Expand all
161 166
162 // |current_frame_lock_| protects |current_frame_used_by_compositor_|, 167 // |current_frame_lock_| protects |current_frame_used_by_compositor_|,
163 // |current_frame_|, and |rendering_frame_buffer_|. 168 // |current_frame_|, and |rendering_frame_buffer_|.
164 base::Lock current_frame_lock_; 169 base::Lock current_frame_lock_;
165 170
166 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor); 171 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor);
167 }; 172 };
168 } // namespace content 173 } // namespace content
169 174
170 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ 175 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698