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

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

Issue 2769543002: [Mojo Video Capture] Introduce abstraction VideoCaptureSystem (Closed)
Patch Set: Created 3 years, 9 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/media_stream_manager.h" 5 #include "content/browser/renderer_host/media/media_stream_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/public/browser/web_contents_media_capture_id.h" 42 #include "content/public/browser/web_contents_media_capture_id.h"
43 #include "content/public/common/content_client.h" 43 #include "content/public/common/content_client.h"
44 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
45 #include "content/public/common/media_stream_request.h" 45 #include "content/public/common/media_stream_request.h"
46 #include "crypto/hmac.h" 46 #include "crypto/hmac.h"
47 #include "media/audio/audio_device_description.h" 47 #include "media/audio/audio_device_description.h"
48 #include "media/audio/audio_manager.h" 48 #include "media/audio/audio_manager.h"
49 #include "media/base/audio_parameters.h" 49 #include "media/base/audio_parameters.h"
50 #include "media/base/channel_layout.h" 50 #include "media/base/channel_layout.h"
51 #include "media/base/media_switches.h" 51 #include "media/base/media_switches.h"
52 #include "media/capture/video/video_capture_device_factory.h" 52 #include "media/capture/video/video_capture_system.h"
53 #include "url/gurl.h" 53 #include "url/gurl.h"
54 #include "url/origin.h" 54 #include "url/origin.h"
55 55
56 #if defined(OS_WIN) 56 #if defined(OS_WIN)
57 #include "base/win/scoped_com_initializer.h" 57 #include "base/win/scoped_com_initializer.h"
58 #endif 58 #endif
59 59
60 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
61 #include "chromeos/audio/cras_audio_handler.h" 61 #include "chromeos/audio/cras_audio_handler.h"
62 #endif 62 #endif
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 3")); 1251 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 3"));
1252 // We want to be notified of IO message loop destruction to delete the thread 1252 // We want to be notified of IO message loop destruction to delete the thread
1253 // and the device managers. 1253 // and the device managers.
1254 base::MessageLoop::current()->AddDestructionObserver(this); 1254 base::MessageLoop::current()->AddDestructionObserver(this);
1255 1255
1256 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is 1256 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is
1257 // fixed. 1257 // fixed.
1258 tracked_objects::ScopedTracker tracking_profile4( 1258 tracked_objects::ScopedTracker tracking_profile4(
1259 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1259 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1260 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4")); 1260 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4"));
1261 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystem>(
1262 media::VideoCaptureDeviceFactory::CreateFactory(
1263 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
1261 #if defined(OS_WIN) 1264 #if defined(OS_WIN)
1262 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of 1265 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of
1263 // buggy third party Direct Show modules, http://crbug.com/428958. 1266 // buggy third party Direct Show modules, http://crbug.com/428958.
1264 video_capture_thread_.init_com_with_mta(false); 1267 video_capture_thread_.init_com_with_mta(false);
1265 CHECK(video_capture_thread_.Start()); 1268 CHECK(video_capture_thread_.Start());
1266 video_capture_manager_ = new VideoCaptureManager( 1269 video_capture_manager_ = new VideoCaptureManager(
1267 media::VideoCaptureDeviceFactory::CreateFactory( 1270 std::move(video_capture_system), video_capture_thread_.task_runner());
1268 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)),
1269 video_capture_thread_.task_runner());
1270 #else 1271 #else
1271 video_capture_manager_ = new VideoCaptureManager( 1272 video_capture_manager_ = new VideoCaptureManager(
1272 media::VideoCaptureDeviceFactory::CreateFactory( 1273 std::move(video_capture_system), device_task_runner_);
1273 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)),
1274 device_task_runner_);
1275 #endif 1274 #endif
1276 1275
1277 video_capture_manager_->RegisterListener(this); 1276 video_capture_manager_->RegisterListener(this);
1278 1277
1279 media_devices_manager_.reset( 1278 media_devices_manager_.reset(
1280 new MediaDevicesManager(audio_manager_, video_capture_manager_, this)); 1279 new MediaDevicesManager(audio_manager_, video_capture_manager_, this));
1281 } 1280 }
1282 1281
1283 void MediaStreamManager::Opened(MediaStreamType stream_type, 1282 void MediaStreamManager::Opened(MediaStreamType stream_type,
1284 int capture_session_id) { 1283 int capture_session_id) {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 request->ui_proxy->OnStarted( 1773 request->ui_proxy->OnStarted(
1775 base::Bind(&MediaStreamManager::StopMediaStreamFromBrowser, 1774 base::Bind(&MediaStreamManager::StopMediaStreamFromBrowser,
1776 base::Unretained(this), label), 1775 base::Unretained(this), label),
1777 base::Bind(&MediaStreamManager::OnMediaStreamUIWindowId, 1776 base::Bind(&MediaStreamManager::OnMediaStreamUIWindowId,
1778 base::Unretained(this), request->video_type(), 1777 base::Unretained(this), request->video_type(),
1779 request->devices)); 1778 request->devices));
1780 } 1779 }
1781 } 1780 }
1782 1781
1783 } // namespace content 1782 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698