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

Side by Side Diff: content/renderer/media/media_stream_video_capturer_source.cc

Issue 1873293002: Report if video capturing meets output protection requirement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments and rebased. Created 4 years, 7 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/media_stream_video_capturer_source.h" 5 #include "content/renderer/media/media_stream_video_capturer_source.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "content/common/media/media_stream_messages.h"
14 #include "content/public/common/media_stream_request.h" 15 #include "content/public/common/media_stream_request.h"
15 #include "content/renderer/media/media_stream_constraints_util.h" 16 #include "content/renderer/media/media_stream_constraints_util.h"
16 #include "content/renderer/media/video_capture_impl_manager.h" 17 #include "content/renderer/media/video_capture_impl_manager.h"
17 #include "content/renderer/render_thread_impl.h" 18 #include "content/renderer/render_thread_impl.h"
18 #include "media/base/bind_to_current_loop.h" 19 #include "media/base/bind_to_current_loop.h"
19 #include "media/base/limits.h" 20 #include "media/base/limits.h"
20 #include "media/base/video_capturer_source.h" 21 #include "media/base/video_capturer_source.h"
21 #include "media/base/video_frame.h" 22 #include "media/base/video_frame.h"
22 23
23 namespace content { 24 namespace content {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 312 }
312 313
313 void LocalVideoCapturerSource::RequestRefreshFrame() { 314 void LocalVideoCapturerSource::RequestRefreshFrame() {
314 DVLOG(3) << __FUNCTION__; 315 DVLOG(3) << __FUNCTION__;
315 DCHECK(thread_checker_.CalledOnValidThread()); 316 DCHECK(thread_checker_.CalledOnValidThread());
316 if (stop_capture_cb_.is_null()) 317 if (stop_capture_cb_.is_null())
317 return; // Do not request frames if the source is stopped. 318 return; // Do not request frames if the source is stopped.
318 manager_->RequestRefreshFrame(session_id_); 319 manager_->RequestRefreshFrame(session_id_);
319 } 320 }
320 321
321
322 void LocalVideoCapturerSource::StopCapture() { 322 void LocalVideoCapturerSource::StopCapture() {
323 DVLOG(3) << __FUNCTION__; 323 DVLOG(3) << __FUNCTION__;
324 DCHECK(thread_checker_.CalledOnValidThread()); 324 DCHECK(thread_checker_.CalledOnValidThread());
325 // Immediately make sure we don't provide more frames. 325 // Immediately make sure we don't provide more frames.
326 if (!stop_capture_cb_.is_null()) 326 if (!stop_capture_cb_.is_null())
327 base::ResetAndReturn(&stop_capture_cb_).Run(); 327 base::ResetAndReturn(&stop_capture_cb_).Run();
328 running_callback_.Reset(); 328 running_callback_.Reset();
329 // Invalidate any potential format enumerations going on. 329 // Invalidate any potential format enumerations going on.
330 formats_enumerated_callback_.Reset(); 330 formats_enumerated_callback_.Reset();
331 } 331 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 gfx::Size(resolution.width, resolution.height), frame_rate, 386 gfx::Size(resolution.width, resolution.height), frame_rate,
387 media::PIXEL_FORMAT_I420)); 387 media::PIXEL_FORMAT_I420));
388 } 388 }
389 } 389 }
390 base::ResetAndReturn(&formats_enumerated_callback_).Run(default_formats); 390 base::ResetAndReturn(&formats_enumerated_callback_).Run(default_formats);
391 } 391 }
392 392
393 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource( 393 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource(
394 const SourceStoppedCallback& stop_callback, 394 const SourceStoppedCallback& stop_callback,
395 std::unique_ptr<media::VideoCapturerSource> source) 395 std::unique_ptr<media::VideoCapturerSource> source)
396 : source_(std::move(source)) { 396 : source_(std::move(source)), render_frame_(nullptr) {
397 SetStopCallback(stop_callback); 397 SetStopCallback(stop_callback);
398 } 398 }
399 399
400 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource( 400 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource(
401 const SourceStoppedCallback& stop_callback, 401 const SourceStoppedCallback& stop_callback,
402 const StreamDeviceInfo& device_info) 402 const StreamDeviceInfo& device_info,
403 : source_(new LocalVideoCapturerSource(device_info)) { 403 RenderFrame* render_frame)
404 : source_(new LocalVideoCapturerSource(device_info)),
405 render_frame_(render_frame) {
404 SetStopCallback(stop_callback); 406 SetStopCallback(stop_callback);
405 SetDeviceInfo(device_info); 407 SetDeviceInfo(device_info);
406 } 408 }
407 409
408 MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() { 410 MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() {
409 } 411 }
410 412
411 void MediaStreamVideoCapturerSource::RequestRefreshFrame() { 413 void MediaStreamVideoCapturerSource::RequestRefreshFrame() {
412 source_->RequestRefreshFrame(); 414 source_->RequestRefreshFrame();
413 } 415 }
414 416
417 void MediaStreamVideoCapturerSource::SetCapturingLinkSecured(bool is_secure) {
418 if (render_frame_) {
miu 2016/05/06 18:56:22 If this class extends RenderFrameObserver, all the
xjz 2016/05/06 22:08:45 Done.
419 render_frame_->Send(new MediaStreamHostMsg_SetCapturingLinkSecured(
420 device_info().session_id, device_info().device.type, is_secure));
421 }
422 }
423
415 void MediaStreamVideoCapturerSource::GetCurrentSupportedFormats( 424 void MediaStreamVideoCapturerSource::GetCurrentSupportedFormats(
416 int max_requested_width, 425 int max_requested_width,
417 int max_requested_height, 426 int max_requested_height,
418 double max_requested_frame_rate, 427 double max_requested_frame_rate,
419 const VideoCaptureDeviceFormatsCB& callback) { 428 const VideoCaptureDeviceFormatsCB& callback) {
420 source_->GetCurrentSupportedFormats( 429 source_->GetCurrentSupportedFormats(
421 max_requested_width, 430 max_requested_width,
422 max_requested_height, 431 max_requested_height,
423 max_requested_frame_rate, 432 max_requested_frame_rate,
424 callback); 433 callback);
(...skipping 25 matching lines...) Expand all
450 void MediaStreamVideoCapturerSource::OnStarted(bool result) { 459 void MediaStreamVideoCapturerSource::OnStarted(bool result) {
451 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); 460 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE);
452 } 461 }
453 462
454 const char* 463 const char*
455 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { 464 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const {
456 return kPowerLineFrequency; 465 return kPowerLineFrequency;
457 } 466 }
458 467
459 } // namespace content 468 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698