OLD | NEW |
---|---|
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 Loading... | |
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 |
80 // Used to DCHECK that we are called on Render main Thread. | |
81 base::ThreadChecker render_thread_checker_; | |
wolenetz
2015/03/11 23:37:37
I'm confused: which thread_checker_ was previously
mcasas
2015/03/13 01:09:34
I consolidated the ThreadCheckers in the different
| |
82 | |
84 std::vector<MediaStreamVideoSink*> sinks_; | 83 std::vector<MediaStreamVideoSink*> sinks_; |
85 | 84 |
86 // |FrameDeliverer| is an internal helper object used for delivering video | 85 // |FrameDeliverer| is an internal helper object used for delivering video |
87 // frames on the IO-thread using callbacks to all registered tracks. | 86 // frames on the IO-thread using callbacks to all registered tracks. |
88 class FrameDeliverer; | 87 class FrameDeliverer; |
89 scoped_refptr<FrameDeliverer> frame_deliverer_; | 88 const scoped_refptr<FrameDeliverer> frame_deliverer_; |
90 | 89 |
91 blink::WebMediaConstraints constraints_; | 90 const blink::WebMediaConstraints constraints_; |
92 | 91 |
93 // Weak ref to the source this tracks is connected to. |source_| is owned | 92 // Weak ref to the source this tracks is connected to. |source_| is owned |
94 // by the blink::WebMediaStreamSource and is guaranteed to outlive the | 93 // by the blink::WebMediaStreamSource and is guaranteed to outlive the |
95 // track. | 94 // track. |
96 MediaStreamVideoSource* source_; | 95 MediaStreamVideoSource* source_; |
97 | 96 |
98 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); | 97 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); |
99 }; | 98 }; |
100 | 99 |
101 } // namespace content | 100 } // namespace content |
102 | 101 |
103 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ | 102 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ |
OLD | NEW |