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

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

Issue 976233002: MediaStreamVideo*/VideoTrackAdapter and RTCVideoRenderer (small) cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi@ comments Created 5 years, 9 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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void SetEnabled(bool enabled) override; 52 void SetEnabled(bool enabled) override;
53 53
54 void Stop() override; 54 void Stop() override;
55 55
56 void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state); 56 void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state);
57 57
58 const blink::WebMediaConstraints& constraints() const { 58 const blink::WebMediaConstraints& constraints() const {
59 return constraints_; 59 return constraints_;
60 } 60 }
61 61
62 protected:
63 // Used to DCHECK that we are called on the correct thread.
64 base::ThreadChecker thread_checker_;
65
66 private: 62 private:
67 // MediaStreamVideoSink is a friend to allow it to call AddSink() and 63 // MediaStreamVideoSink is a friend to allow it to call AddSink() and
68 // RemoveSink(). 64 // RemoveSink().
69 friend class MediaStreamVideoSink; 65 friend class MediaStreamVideoSink;
70 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, StartTrack); 66 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, StartTrack);
71 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, RemoteTrackStop); 67 FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, RemoteTrackStop);
72 FRIEND_TEST_ALL_PREFIXES(VideoDestinationHandlerTest, PutFrame); 68 FRIEND_TEST_ALL_PREFIXES(VideoDestinationHandlerTest, PutFrame);
73 69
74 // Add |sink| to receive state changes on the main render thread and video 70 // Add |sink| to receive state changes on the main render thread and video
75 // frames in the |callback| method on the IO-thread. 71 // frames in the |callback| method on the IO-thread.
76 // |callback| will be reset on the render thread. 72 // |callback| will be reset on the render thread.
77 // These two methods are private such that no subclass can intercept and 73 // These two methods are private such that no subclass can intercept and
78 // store the callback. This is important to ensure that we can release 74 // store the callback. This is important to ensure that we can release
79 // the callback on render thread without reference to it on the IO-thread. 75 // the callback on render thread without reference to it on the IO-thread.
80 void AddSink(MediaStreamVideoSink* sink, 76 void AddSink(MediaStreamVideoSink* sink,
81 const VideoCaptureDeliverFrameCB& callback); 77 const VideoCaptureDeliverFrameCB& callback);
82 void RemoveSink(MediaStreamVideoSink* sink); 78 void RemoveSink(MediaStreamVideoSink* sink);
83 79
84 std::vector<MediaStreamVideoSink*> sinks_; 80 std::vector<MediaStreamVideoSink*> sinks_;
85 81
86 // |FrameDeliverer| is an internal helper object used for delivering video 82 // |FrameDeliverer| is an internal helper object used for delivering video
87 // frames on the IO-thread using callbacks to all registered tracks. 83 // frames on the IO-thread using callbacks to all registered tracks.
88 class FrameDeliverer; 84 class FrameDeliverer;
89 scoped_refptr<FrameDeliverer> frame_deliverer_; 85 const scoped_refptr<FrameDeliverer> frame_deliverer_;
90 86
91 blink::WebMediaConstraints constraints_; 87 const blink::WebMediaConstraints constraints_;
92 88
93 // Weak ref to the source this tracks is connected to. |source_| is owned 89 // Weak ref to the source this tracks is connected to. |source_| is owned
94 // by the blink::WebMediaStreamSource and is guaranteed to outlive the 90 // by the blink::WebMediaStreamSource and is guaranteed to outlive the
95 // track. 91 // track.
96 MediaStreamVideoSource* source_; 92 MediaStreamVideoSource* source_;
97 93
98 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); 94 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack);
99 }; 95 };
100 96
101 } // namespace content 97 } // namespace content
102 98
103 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 99 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_source.h ('k') | content/renderer/media/media_stream_video_track.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698