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

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

Issue 2339193002: Wip - cl for implemening VideoTrackSource::ApplyConstraints(constraints, VideoTrack) and adopt safe…
Patch Set: Created 4 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TRACK_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/renderer/media_stream_video_sink.h" 15 #include "content/public/renderer/media_stream_video_sink.h"
16 #include "content/renderer/media/media_stream_track.h" 16 #include "content/renderer/media/media_stream_track.h"
17 #include "content/renderer/media/media_stream_video_source.h" 17 #include "content/renderer/media/media_stream_video_source.h"
18 #include "content/renderer/media/secure_display_link_tracker.h" 18 #include "content/renderer/media/secure_display_link_tracker.h"
19 19
20 namespace content { 20 namespace content {
21 21
22 // MediaStreamVideoTrack is a video specific representation of a 22 // MediaStreamVideoTrack is a video specific representation of a
23 // blink::WebMediaStreamTrack in content. It is owned by the blink object 23 // blink::WebMediaStreamTrack in content. It is owned by the blink object
24 // and can be retrieved from a blink object using 24 // and can be retrieved from a blink object using
25 // WebMediaStreamTrack::getExtraData() or MediaStreamVideoTrack::GetVideoTrack. 25 // WebMediaStreamTrack::getExtraData() or MediaStreamVideoTrack::GetVideoTrack.
26 class CONTENT_EXPORT MediaStreamVideoTrack : public MediaStreamTrack { 26 class CONTENT_EXPORT MediaStreamVideoTrack : public MediaStreamTrack {
27 public: 27 public:
28 // Help method to create a blink::WebMediaStreamTrack and a 28 // Help method to create a blink::WebMediaStreamTrack and register to |source|
29 // to receive video frames.
29 // MediaStreamVideoTrack instance. The MediaStreamVideoTrack object is owned 30 // MediaStreamVideoTrack instance. The MediaStreamVideoTrack object is owned
30 // by the blink object in its WebMediaStreamTrack::ExtraData member. 31 // by the blink object in its WebMediaStreamTrack::ExtraData member.
31 // |callback| is triggered if the track is added to the source 32 static blink::WebMediaStreamTrack
32 // successfully and will receive video frames that match |constraints| 33 CreateVideoTrack(MediaStreamVideoSource* source);
33 // or if the source fail to provide video frames. 34
34 // If |enabled| is true, sinks added to the track will 35 static void InitializeVideoTrack(MediaStreamVideoSource* source,
35 // receive video frames when the source deliver frames to the track. 36 const blink::WebMediaStreamTrack& track);
36 static blink::WebMediaStreamTrack CreateVideoTrack(
37 MediaStreamVideoSource* source,
38 const blink::WebMediaConstraints& constraints,
39 const MediaStreamVideoSource::ConstraintsCallback& callback,
40 bool enabled);
41 37
42 static MediaStreamVideoTrack* GetVideoTrack( 38 static MediaStreamVideoTrack* GetVideoTrack(
43 const blink::WebMediaStreamTrack& track); 39 const blink::WebMediaStreamTrack& track);
44 40
45 // Constructor for video tracks.
46 MediaStreamVideoTrack(
47 MediaStreamVideoSource* source,
48 const blink::WebMediaConstraints& constraints,
49 const MediaStreamVideoSource::ConstraintsCallback& callback,
50 bool enabled);
51 ~MediaStreamVideoTrack() override; 41 ~MediaStreamVideoTrack() override;
52 42
53 // MediaStreamTrack overrides. 43 // MediaStreamTrack overrides.
54 void SetEnabled(bool enabled) override; 44 void SetEnabled(bool enabled) override;
55 void Stop() override; 45 void Stop() override;
56 void getSettings(blink::WebMediaStreamTrack::Settings& settings) override; 46 void getSettings(blink::WebMediaStreamTrack::Settings& settings) override;
57 47
58 void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state); 48 void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state);
59 49
60 const blink::WebMediaConstraints& constraints() const { return constraints_; } 50 const blink::WebMediaConstraints& constraints() const { return constraints_; }
61 51
52 VideoCaptureDeliverFrameCB frame_input() const;
53
54 protected:
55 friend class MediaStreamVideoSource;
56 // Constructor for video tracks.
57 MediaStreamVideoTrack(base::WeakPtr<MediaStreamVideoSource> source,
58 bool enabled);
62 private: 59 private:
63 // MediaStreamVideoSink is a friend to allow it to call AddSink() and 60 // MediaStreamVideoSink is a friend to allow it to call AddSink() and
64 // RemoveSink(). 61 // RemoveSink() and to create MediaStreamVideoTracks.
65 friend class MediaStreamVideoSink; 62 friend class MediaStreamVideoSink;
66 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, StartTrack); 63 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, StartTrack);
67 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, RemoteTrackStop); 64 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, RemoteTrackStop);
68 FRIEND_TEST_ALL_PREFIXES(PepperToVideoTrackAdapterTest, PutFrame); 65 FRIEND_TEST_ALL_PREFIXES(PepperToVideoTrackAdapterTest, PutFrame);
69 66
70 // Add |sink| to receive state changes on the main render thread and video 67 // Add |sink| to receive state changes on the main render thread and video
71 // frames in the |callback| method on the IO-thread. 68 // frames in the |callback| method on the IO-thread.
72 // |callback| will be reset on the render thread. 69 // |callback| will be reset on the render thread.
73 // These two methods are private such that no subclass can intercept and 70 // These two methods are private such that no subclass can intercept and
74 // store the callback. This is important to ensure that we can release 71 // store the callback. This is important to ensure that we can release
(...skipping 17 matching lines...) Expand all
92 89
93 // This is used for tracking if all connected video sinks are secure. 90 // This is used for tracking if all connected video sinks are secure.
94 SecureDisplayLinkTracker<MediaStreamVideoSink> secure_tracker_; 91 SecureDisplayLinkTracker<MediaStreamVideoSink> secure_tracker_;
95 92
96 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); 93 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack);
97 }; 94 };
98 95
99 } // namespace content 96 } // namespace content
100 97
101 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 98 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_source.cc ('k') | content/renderer/media/media_stream_video_track.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698