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

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

Issue 2393923002: Add unit tests for webrtc_media_stream_adapter.cc (Closed)
Patch Set: Addressed review comments 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 #include "content/renderer/media/webrtc/media_stream_video_webrtc_sink.h" 5 #include "content/renderer/media/webrtc/media_stream_video_webrtc_sink.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 DCHECK(libjingle_worker_thread_->BelongsToCurrentThread()); 199 DCHECK(libjingle_worker_thread_->BelongsToCurrentThread());
200 base::AutoLock auto_lock(capture_adapter_stop_lock_); 200 base::AutoLock auto_lock(capture_adapter_stop_lock_);
201 if (capture_adapter_) 201 if (capture_adapter_)
202 capture_adapter_->OnFrameCaptured(frame); 202 capture_adapter_->OnFrameCaptured(frame);
203 } 203 }
204 204
205 MediaStreamVideoWebRtcSink::MediaStreamVideoWebRtcSink( 205 MediaStreamVideoWebRtcSink::MediaStreamVideoWebRtcSink(
206 const blink::WebMediaStreamTrack& track, 206 const blink::WebMediaStreamTrack& track,
207 PeerConnectionDependencyFactory* factory) 207 PeerConnectionDependencyFactory* factory)
208 : weak_factory_(this) { 208 : weak_factory_(this) {
209 DCHECK(MediaStreamVideoTrack::GetVideoTrack(track));
209 const blink::WebMediaConstraints& constraints = 210 const blink::WebMediaConstraints& constraints =
210 MediaStreamVideoTrack::GetVideoTrack(track)->constraints(); 211 MediaStreamVideoTrack::GetVideoTrack(track)->constraints();
211 212
212 // Check for presence of mediaStreamSource constraint. The value is ignored. 213 // Check for presence of mediaStreamSource constraint. The value is ignored.
213 std::string value; 214 std::string value;
214 bool is_screencast = GetConstraintValueAsString( 215 bool is_screencast = GetConstraintValueAsString(
215 constraints, &blink::WebMediaTrackConstraintSet::mediaStreamSource, 216 constraints, &blink::WebMediaTrackConstraintSet::mediaStreamSource,
216 &value); 217 &value);
217 218
218 // Extract denoising preference, if no value is set this currently falls back 219 // Extract denoising preference, if no value is set this currently falls back
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 void MediaStreamVideoWebRtcSink::OnEnabledChanged(bool enabled) { 306 void MediaStreamVideoWebRtcSink::OnEnabledChanged(bool enabled) {
306 DCHECK(thread_checker_.CalledOnValidThread()); 307 DCHECK(thread_checker_.CalledOnValidThread());
307 video_track_->set_enabled(enabled); 308 video_track_->set_enabled(enabled);
308 } 309 }
309 310
310 void MediaStreamVideoWebRtcSink::RequestRefreshFrame() { 311 void MediaStreamVideoWebRtcSink::RequestRefreshFrame() {
311 DCHECK(thread_checker_.CalledOnValidThread()); 312 DCHECK(thread_checker_.CalledOnValidThread());
312 content::RequestRefreshFrameFromVideoTrack(connected_track()); 313 content::RequestRefreshFrameFromVideoTrack(connected_track());
313 } 314 }
314 315
316 rtc::Optional<bool> MediaStreamVideoWebRtcSink::SourceNeedsDenoisingTestHelper()
317 const {
318 return video_source_->needs_denoising();
319 }
320
315 } // namespace content 321 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698