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

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 1952463002: Media Stream Image Capture (4): wire takePhoto and implement in FakeVCDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: miu@s comments 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/renderer_host/media/video_capture_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 device_task_runner_->PostTask( 779 device_task_runner_->PostTask(
780 FROM_HERE, 780 FROM_HERE,
781 base::Bind(&VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread, 781 base::Bind(&VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread,
782 this, 782 this,
783 existing_device->video_capture_device(), 783 existing_device->video_capture_device(),
784 window_id_it->second)); 784 window_id_it->second));
785 785
786 notification_window_ids_.erase(window_id_it); 786 notification_window_ids_.erase(window_id_it);
787 } 787 }
788 788
789 bool VideoCaptureManager::TakePhoto(
790 int session_id,
791 const media::VideoCaptureDevice::TakePhotoCallback& photo_callback) {
792 DCHECK_CURRENTLY_ON(BrowserThread::IO);
793 SessionMap::const_iterator session_it = sessions_.find(session_id);
794 if (session_it == sessions_.end())
795 return false;
796
797 DeviceEntry* const device_info =
798 GetDeviceEntryForMediaStreamDevice(session_it->second);
799 if (!device_info)
800 return false;
801 return device_info->video_capture_device()->TakePhoto(photo_callback);
802 }
803
789 void VideoCaptureManager::DoStopDeviceOnDeviceThread( 804 void VideoCaptureManager::DoStopDeviceOnDeviceThread(
790 std::unique_ptr<media::VideoCaptureDevice> device) { 805 std::unique_ptr<media::VideoCaptureDevice> device) {
791 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StopDeviceTime"); 806 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StopDeviceTime");
792 DCHECK(IsOnDeviceThread()); 807 DCHECK(IsOnDeviceThread());
793 device->StopAndDeAllocate(); 808 device->StopAndDeAllocate();
794 DVLOG(3) << "DoStopDeviceOnDeviceThread"; 809 DVLOG(3) << "DoStopDeviceOnDeviceThread";
795 } 810 }
796 811
797 void VideoCaptureManager::OnOpened( 812 void VideoCaptureManager::OnOpened(
798 MediaStreamType stream_type, 813 MediaStreamType stream_type,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 continue; 1063 continue;
1049 1064
1050 // Session ID is only valid for Screen capture. So we can fake it to resume 1065 // Session ID is only valid for Screen capture. So we can fake it to resume
1051 // video capture devices here. 1066 // video capture devices here.
1052 QueueStartDevice(kFakeSessionId, entry, entry->parameters); 1067 QueueStartDevice(kFakeSessionId, entry, entry->parameters);
1053 } 1068 }
1054 } 1069 }
1055 #endif // defined(OS_ANDROID) 1070 #endif // defined(OS_ANDROID)
1056 1071
1057 } // namespace content 1072 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698