| 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_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| 11 #include "content/public/renderer/media_stream_video_sink.h" | 11 #include "content/public/renderer/media_stream_video_sink.h" |
| 12 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 12 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 14 #include "third_party/webrtc/api/mediastreaminterface.h" | 14 #include "third_party/webrtc/api/mediastreaminterface.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 class MediaStreamVideoTrack; | 18 class MediaStreamVideoTrack; |
| 19 class PeerConnectionDependencyFactory; | 19 class PeerConnectionDependencyFactory; |
| 20 | 20 |
| 21 // MediaStreamVideoWebRtcSink is an adapter between a | 21 // MediaStreamVideoWebRtcSink is an adapter between a |
| 22 // content::MediaStreamVideoTrack object and a webrtc VideoTrack that is | 22 // content::MediaStreamVideoTrack object and a webrtc VideoTrack that is |
| 23 // currently sent on a PeerConnection. | 23 // currently sent on a PeerConnection. |
| 24 // The responsibility of the class is to create and own a representation of a | 24 // The responsibility of the class is to create and own a representation of a |
| 25 // webrtc VideoTrack that can be added and removed from a RTCPeerConnection. An | 25 // webrtc VideoTrack that can be added and removed from a RTCPeerConnection. An |
| 26 // instance of MediaStreamVideoWebRtcSink is created when a VideoTrack is added | 26 // instance of MediaStreamVideoWebRtcSink is created when a VideoTrack is added |
| 27 // to an RTCPeerConnection object. | 27 // to an RTCPeerConnection object. |
| 28 // Instances of this class is owned by the WebRtcMediaStreamAdapter object that | 28 // Instances of this class is owned by the WebRtcMediaStreamAdapter object that |
| 29 // created it. | 29 // created it. |
| 30 class MediaStreamVideoWebRtcSink : public MediaStreamVideoSink { | 30 class CONTENT_EXPORT MediaStreamVideoWebRtcSink : public MediaStreamVideoSink { |
| 31 public: | 31 public: |
| 32 MediaStreamVideoWebRtcSink(const blink::WebMediaStreamTrack& track, | 32 MediaStreamVideoWebRtcSink(const blink::WebMediaStreamTrack& track, |
| 33 PeerConnectionDependencyFactory* factory); | 33 PeerConnectionDependencyFactory* factory); |
| 34 ~MediaStreamVideoWebRtcSink() override; | 34 ~MediaStreamVideoWebRtcSink() override; |
| 35 | 35 |
| 36 webrtc::VideoTrackInterface* webrtc_video_track() { | 36 webrtc::VideoTrackInterface* webrtc_video_track() { |
| 37 return video_track_.get(); | 37 return video_track_.get(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 rtc::Optional<bool> SourceNeedsDenoisingForTesting() const; |
| 41 |
| 40 protected: | 42 protected: |
| 41 // Implementation of MediaStreamSink. | 43 // Implementation of MediaStreamSink. |
| 42 void OnEnabledChanged(bool enabled) override; | 44 void OnEnabledChanged(bool enabled) override; |
| 43 | 45 |
| 44 private: | 46 private: |
| 45 // Helper to request a refresh frame from the source. Called via the callback | 47 // Helper to request a refresh frame from the source. Called via the callback |
| 46 // passed to WebRtcVideoSourceAdapter. | 48 // passed to WebRtcVideoSourceAdapter. |
| 47 void RequestRefreshFrame(); | 49 void RequestRefreshFrame(); |
| 48 | 50 |
| 49 // Used to DCHECK that we are called on the correct thread. | 51 // Used to DCHECK that we are called on the correct thread. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 64 // MediaStreamVideoWebRtcSink in order to allow it to request refresh frames. | 66 // MediaStreamVideoWebRtcSink in order to allow it to request refresh frames. |
| 65 // See comments in media_stream_video_webrtc_sink.cc. | 67 // See comments in media_stream_video_webrtc_sink.cc. |
| 66 base::WeakPtrFactory<MediaStreamVideoWebRtcSink> weak_factory_; | 68 base::WeakPtrFactory<MediaStreamVideoWebRtcSink> weak_factory_; |
| 67 | 69 |
| 68 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoWebRtcSink); | 70 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoWebRtcSink); |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 } // namespace content | 73 } // namespace content |
| 72 | 74 |
| 73 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ | 75 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ |
| OLD | NEW |