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_MEDIA_STREAM_VIDEO_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/common/media/video_capture.h" | 17 #include "content/common/media/video_capture.h" |
18 #include "content/public/renderer/media_stream_video_sink.h" | 18 #include "content/public/renderer/media_stream_video_sink.h" |
19 #include "content/renderer/media/capturing_link_secure_tracker.h" | |
19 #include "content/renderer/media/media_stream_source.h" | 20 #include "content/renderer/media/media_stream_source.h" |
20 #include "media/base/video_capture_types.h" | 21 #include "media/base/video_capture_types.h" |
21 #include "media/base/video_frame.h" | 22 #include "media/base/video_frame.h" |
22 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 23 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
23 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 24 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
24 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 25 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
25 | 26 |
26 namespace content { | 27 namespace content { |
27 | 28 |
28 class MediaStreamVideoTrack; | 29 class MediaStreamVideoTrack; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 static MediaStreamVideoSource* GetVideoSource( | 75 static MediaStreamVideoSource* GetVideoSource( |
75 const blink::WebMediaStreamSource& source); | 76 const blink::WebMediaStreamSource& source); |
76 | 77 |
77 // Puts |track| in the registered tracks list. | 78 // Puts |track| in the registered tracks list. |
78 void AddTrack(MediaStreamVideoTrack* track, | 79 void AddTrack(MediaStreamVideoTrack* track, |
79 const VideoCaptureDeliverFrameCB& frame_callback, | 80 const VideoCaptureDeliverFrameCB& frame_callback, |
80 const blink::WebMediaConstraints& constraints, | 81 const blink::WebMediaConstraints& constraints, |
81 const ConstraintsCallback& callback); | 82 const ConstraintsCallback& callback); |
82 void RemoveTrack(MediaStreamVideoTrack* track); | 83 void RemoveTrack(MediaStreamVideoTrack* track); |
83 | 84 |
85 void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure); | |
86 | |
84 // Return true if |name| is a constraint supported by MediaStreamVideoSource. | 87 // Return true if |name| is a constraint supported by MediaStreamVideoSource. |
85 static bool IsConstraintSupported(const std::string& name); | 88 static bool IsConstraintSupported(const std::string& name); |
86 | 89 |
87 // Request underlying source to capture a new frame. | 90 // Request underlying source to capture a new frame. |
88 virtual void RequestRefreshFrame() {} | 91 virtual void RequestRefreshFrame() {} |
89 | 92 |
93 // Notify underlying source if the capturing link is secure. | |
94 virtual void SetCapturingLinkSecured(bool is_secure) {} | |
95 | |
90 // Returns the task runner where video frames will be delivered on. | 96 // Returns the task runner where video frames will be delivered on. |
91 base::SingleThreadTaskRunner* io_task_runner() const; | 97 base::SingleThreadTaskRunner* io_task_runner() const; |
92 | 98 |
93 const media::VideoCaptureFormat* GetCurrentFormat() const; | 99 const media::VideoCaptureFormat* GetCurrentFormat() const; |
94 | 100 |
95 protected: | 101 protected: |
96 void DoStopSource() override; | 102 void DoStopSource() override; |
97 | 103 |
98 // Sets ready state and notifies the ready state to all registered tracks. | 104 // Sets ready state and notifies the ready state to all registered tracks. |
99 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); | 105 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 std::vector<TrackDescriptor> track_descriptors_; | 186 std::vector<TrackDescriptor> track_descriptors_; |
181 | 187 |
182 media::VideoCaptureFormats supported_formats_; | 188 media::VideoCaptureFormats supported_formats_; |
183 | 189 |
184 // |track_adapter_| delivers video frames to the tracks on the IO-thread. | 190 // |track_adapter_| delivers video frames to the tracks on the IO-thread. |
185 const scoped_refptr<VideoTrackAdapter> track_adapter_; | 191 const scoped_refptr<VideoTrackAdapter> track_adapter_; |
186 | 192 |
187 // Tracks that currently are connected to this source. | 193 // Tracks that currently are connected to this source. |
188 std::vector<MediaStreamVideoTrack*> tracks_; | 194 std::vector<MediaStreamVideoTrack*> tracks_; |
189 | 195 |
196 // This is used for tracking if all connected video sinks are secure. | |
197 std::unique_ptr<CapturingLinkSecureTracker<MediaStreamVideoTrack>> | |
miu
2016/04/26 01:25:14
Please remove the indirection here.
xjz
2016/04/29 00:11:42
Done.
| |
198 secure_tracker_; | |
199 | |
190 // NOTE: Weak pointers must be invalidated before all other member variables. | 200 // NOTE: Weak pointers must be invalidated before all other member variables. |
191 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; | 201 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; |
192 | 202 |
193 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); | 203 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); |
194 }; | 204 }; |
195 | 205 |
196 } // namespace content | 206 } // namespace content |
197 | 207 |
198 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ | 208 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ |
OLD | NEW |