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

Side by Side Diff: content/renderer/media/webrtc/media_stream_video_webrtc_sink.h

Issue 2393923002: Add unit tests for webrtc_media_stream_adapter.cc (Closed)
Patch Set: Completed tests for denoising constraint Created 4 years, 2 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 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 // Exposed for testing.
41 rtc::Optional<bool> SourceNeedsDenoising();
tommi (sloooow) - chröme 2016/10/10 09:53:35 SourceNeedsDenoisingForTesting() Should it also b
hta - Chromium 2016/10/10 13:15:02 I don't like having derived classes as the impleme
tommi (sloooow) - chröme 2016/10/10 13:33:37 The convention is to have the suffix "ForTesting",
mcasas 2016/10/10 15:58:22 On that: "Functions used only for testing should
hta - Chromium 2016/10/10 18:59:01 Ack - if the "ForTesting suffix is magical, it mak
tommi (sloooow) - chröme 2016/10/10 19:10:36 That's OK with me. Just to clarify my comment, th
42
40 protected: 43 protected:
41 // Implementation of MediaStreamSink. 44 // Implementation of MediaStreamSink.
42 void OnEnabledChanged(bool enabled) override; 45 void OnEnabledChanged(bool enabled) override;
43 46
44 private: 47 private:
45 // Helper to request a refresh frame from the source. Called via the callback 48 // Helper to request a refresh frame from the source. Called via the callback
46 // passed to WebRtcVideoSourceAdapter. 49 // passed to WebRtcVideoSourceAdapter.
47 void RequestRefreshFrame(); 50 void RequestRefreshFrame();
48 51
49 // Used to DCHECK that we are called on the correct thread. 52 // Used to DCHECK that we are called on the correct thread.
(...skipping 14 matching lines...) Expand all
64 // MediaStreamVideoWebRtcSink in order to allow it to request refresh frames. 67 // MediaStreamVideoWebRtcSink in order to allow it to request refresh frames.
65 // See comments in media_stream_video_webrtc_sink.cc. 68 // See comments in media_stream_video_webrtc_sink.cc.
66 base::WeakPtrFactory<MediaStreamVideoWebRtcSink> weak_factory_; 69 base::WeakPtrFactory<MediaStreamVideoWebRtcSink> weak_factory_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoWebRtcSink); 71 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoWebRtcSink);
69 }; 72 };
70 73
71 } // namespace content 74 } // namespace content
72 75
73 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_ 76 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698