OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIDEO_TRACK_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_TRACK_ADAPTER_H_ |
6 #define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_ADAPTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_ADAPTER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
13 #include "content/renderer/media/media_stream_video_track.h" | 15 #include "content/renderer/media/media_stream_video_track.h" |
14 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void RemoveTrackOnIO(const MediaStreamVideoTrack* track); | 79 void RemoveTrackOnIO(const MediaStreamVideoTrack* track); |
78 | 80 |
79 void StartFrameMonitoringOnIO( | 81 void StartFrameMonitoringOnIO( |
80 const OnMutedCallback& on_muted_state_callback, | 82 const OnMutedCallback& on_muted_state_callback, |
81 double source_frame_rate); | 83 double source_frame_rate); |
82 void StopFrameMonitoringOnIO(); | 84 void StopFrameMonitoringOnIO(); |
83 | 85 |
84 // Compare |frame_counter_snapshot| with the current |frame_counter_|, and | 86 // Compare |frame_counter_snapshot| with the current |frame_counter_|, and |
85 // inform of the situation (muted, not muted) via |set_muted_state_callback|. | 87 // inform of the situation (muted, not muted) via |set_muted_state_callback|. |
86 void CheckFramesReceivedOnIO(const OnMutedCallback& set_muted_state_callback, | 88 void CheckFramesReceivedOnIO(const OnMutedCallback& set_muted_state_callback, |
87 uint64 old_frame_counter_snapshot); | 89 uint64_t old_frame_counter_snapshot); |
88 | 90 |
89 // |thread_checker_| is bound to the main render thread. | 91 // |thread_checker_| is bound to the main render thread. |
90 base::ThreadChecker thread_checker_; | 92 base::ThreadChecker thread_checker_; |
91 | 93 |
92 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 94 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
93 | 95 |
94 // |renderer_task_runner_| is used to ensure that | 96 // |renderer_task_runner_| is used to ensure that |
95 // VideoCaptureDeliverFrameCB is released on the main render thread. | 97 // VideoCaptureDeliverFrameCB is released on the main render thread. |
96 const scoped_refptr<base::SingleThreadTaskRunner> renderer_task_runner_; | 98 const scoped_refptr<base::SingleThreadTaskRunner> renderer_task_runner_; |
97 | 99 |
98 // VideoFrameResolutionAdapter is an inner class that is created on the main | 100 // VideoFrameResolutionAdapter is an inner class that is created on the main |
99 // render thread but operates on the IO-thread. It does the resolution | 101 // render thread but operates on the IO-thread. It does the resolution |
100 // adaptation and delivers frames to all registered tracks on the IO-thread. | 102 // adaptation and delivers frames to all registered tracks on the IO-thread. |
101 class VideoFrameResolutionAdapter; | 103 class VideoFrameResolutionAdapter; |
102 typedef std::vector<scoped_refptr<VideoFrameResolutionAdapter> > | 104 typedef std::vector<scoped_refptr<VideoFrameResolutionAdapter> > |
103 FrameAdapters; | 105 FrameAdapters; |
104 FrameAdapters adapters_; | 106 FrameAdapters adapters_; |
105 | 107 |
106 // Set to true if frame monitoring has been started. It is only accessed on | 108 // Set to true if frame monitoring has been started. It is only accessed on |
107 // the IO-thread. | 109 // the IO-thread. |
108 bool monitoring_frame_rate_; | 110 bool monitoring_frame_rate_; |
109 | 111 |
110 // Keeps track of it frames have been received. It is only accessed on the | 112 // Keeps track of it frames have been received. It is only accessed on the |
111 // IO-thread. | 113 // IO-thread. |
112 bool muted_state_; | 114 bool muted_state_; |
113 | 115 |
114 // Running frame counter, accessed on the IO-thread. | 116 // Running frame counter, accessed on the IO-thread. |
115 uint64 frame_counter_; | 117 uint64_t frame_counter_; |
116 | 118 |
117 // Frame rate configured on the video source, accessed on the IO-thread. | 119 // Frame rate configured on the video source, accessed on the IO-thread. |
118 float source_frame_rate_; | 120 float source_frame_rate_; |
119 | 121 |
120 DISALLOW_COPY_AND_ASSIGN(VideoTrackAdapter); | 122 DISALLOW_COPY_AND_ASSIGN(VideoTrackAdapter); |
121 }; | 123 }; |
122 | 124 |
123 } // namespace content | 125 } // namespace content |
124 | 126 |
125 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_ADAPTER_H_ | 127 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_ADAPTER_H_ |
OLD | NEW |