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

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

Issue 2769543002: [Mojo Video Capture] Introduce abstraction VideoCaptureSystem (Closed)
Patch Set: Incorporated suggestions from PatchSet 5 Created 3 years, 8 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_system.h" 48 #include "media/audio/audio_system.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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 3")); 1246 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 3"));
1247 // We want to be notified of IO message loop destruction to delete the thread 1247 // We want to be notified of IO message loop destruction to delete the thread
1248 // and the device managers. 1248 // and the device managers.
1249 base::MessageLoop::current()->AddDestructionObserver(this); 1249 base::MessageLoop::current()->AddDestructionObserver(this);
1250 1250
1251 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is 1251 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is
1252 // fixed. 1252 // fixed.
1253 tracked_objects::ScopedTracker tracking_profile4( 1253 tracked_objects::ScopedTracker tracking_profile4(
1254 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1254 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1255 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4")); 1255 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4"));
1256 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystem>(
1257 media::VideoCaptureDeviceFactory::CreateFactory(
1258 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
1256 #if defined(OS_WIN) 1259 #if defined(OS_WIN)
1257 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of 1260 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of
1258 // buggy third party Direct Show modules, http://crbug.com/428958. 1261 // buggy third party Direct Show modules, http://crbug.com/428958.
1259 video_capture_thread_.init_com_with_mta(false); 1262 video_capture_thread_.init_com_with_mta(false);
1260 CHECK(video_capture_thread_.Start()); 1263 CHECK(video_capture_thread_.Start());
1261 video_capture_manager_ = new VideoCaptureManager( 1264 video_capture_manager_ = new VideoCaptureManager(
1262 media::VideoCaptureDeviceFactory::CreateFactory( 1265 std::move(video_capture_system), video_capture_thread_.task_runner());
1263 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)),
1264 video_capture_thread_.task_runner());
1265 #else 1266 #else
1266 video_capture_manager_ = new VideoCaptureManager( 1267 video_capture_manager_ = new VideoCaptureManager(
1267 media::VideoCaptureDeviceFactory::CreateFactory( 1268 std::move(video_capture_system), audio_system_->GetTaskRunner());
1268 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)),
1269 audio_system_->GetTaskRunner());
1270 #endif 1269 #endif
1271 1270
1272 video_capture_manager_->RegisterListener(this); 1271 video_capture_manager_->RegisterListener(this);
1273 1272
1274 media_devices_manager_.reset( 1273 media_devices_manager_.reset(
1275 new MediaDevicesManager(audio_system_, video_capture_manager_, this)); 1274 new MediaDevicesManager(audio_system_, video_capture_manager_, this));
1276 } 1275 }
1277 1276
1278 void MediaStreamManager::Opened(MediaStreamType stream_type, 1277 void MediaStreamManager::Opened(MediaStreamType stream_type,
1279 int capture_session_id) { 1278 int capture_session_id) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 request->ui_proxy->OnStarted( 1767 request->ui_proxy->OnStarted(
1769 base::Bind(&MediaStreamManager::StopMediaStreamFromBrowser, 1768 base::Bind(&MediaStreamManager::StopMediaStreamFromBrowser,
1770 base::Unretained(this), label), 1769 base::Unretained(this), label),
1771 base::Bind(&MediaStreamManager::OnMediaStreamUIWindowId, 1770 base::Bind(&MediaStreamManager::OnMediaStreamUIWindowId,
1772 base::Unretained(this), request->video_type(), 1771 base::Unretained(this), request->video_type(),
1773 request->devices)); 1772 request->devices));
1774 } 1773 }
1775 } 1774 }
1776 1775
1777 } // namespace content 1776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698