diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-05 10:00:50 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-05 10:00:50 +0000 |
commit | 3a9eba78c7a148b3c2330ac6c4af8ddd49472c1c (patch) | |
tree | 09fd4d07e1592ba28bdac05bf6eb0b128b2c7f65 /media | |
parent | bf40c1ee9c6e74affe5177cc32d91ff76e520ab5 (diff) | |
download | chromium_src-3a9eba78c7a148b3c2330ac6c4af8ddd49472c1c.zip chromium_src-3a9eba78c7a148b3c2330ac6c4af8ddd49472c1c.tar.gz chromium_src-3a9eba78c7a148b3c2330ac6c4af8ddd49472c1c.tar.bz2 |
Revert 210280 "Reconnect support for DirectShow video capture de..."
> Reconnect support for DirectShow video capture devices in parallel to MediaFoundation ones.
>
>
> Implemented merging device driver type for capture devices either Media Foundation
> or DirectShow. Added a static (but local namespace) map indexed by unique id
> having the appropriate type. This is used in Create() to, well, create the
> appropriate driver fron unique_id.
>
> Merged MF and DS devices lists, for this added operator== and operator< to
> VideoCaptureDevice struct; also accepted UYVY and ARGB colorspaces from video
> capture device caps list.
>
> BUG=https://code.google.com/p/chromium/issues/detail?id=144465
>
> Review URL: https://chromiumcodereview.appspot.com/17402002
Reason for revert: The VideoCaptureDeviceTest.OpenInvalidDevice test,
that was modified in a Windows-specific way in the reverted revision
is crashing on Windows XP only (for two runs in a row now). It's
crashing on a CHECK, see below:
[... FATAL:video_capture_device_win.cc(171)] Check failed: VideoCaptureDeviceMFWin::PlatformSupported().
Link to one of the builds:
http://build.chromium.org/p/chromium.win/buildstatus?builder=XP%20Tests%20%28dbg%29%281%29&number=37720
TBR=mcasas@chromium.org
Review URL: https://codereview.chromium.org/18335006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210284 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
4 files changed, 10 insertions, 72 deletions
diff --git a/media/video/capture/video_capture_device.h b/media/video/capture/video_capture_device.h index f571a76..e5be413 100644 --- a/media/video/capture/video_capture_device.h +++ b/media/video/capture/video_capture_device.h @@ -15,7 +15,6 @@ #include <list> #include <string> -#include "base/logging.h" #include "base/time/time.h" #include "media/base/media_export.h" #include "media/video/capture/video_capture_types.h" @@ -37,20 +36,6 @@ class MEDIA_EXPORT VideoCaptureDevice { Name() {} Name(const std::string& name, const std::string& id) : device_name_(name), unique_id_(id) {} - -#if defined(OS_WIN) - // Windows targets Capture Api type: it can only be set on construction. - enum CaptureApiType { - MEDIA_FOUNDATION, - DIRECT_SHOW, - API_TYPE_UNKNOWN - }; - - Name(const std::string& name, - const std::string& id, - const CaptureApiType api_type) - : device_name_(name), unique_id_(id), capture_api_class_(api_type) {} -#endif // if defined(OS_WIN) ~Name() {} // Friendly name of a device @@ -70,33 +55,9 @@ class MEDIA_EXPORT VideoCaptureDevice { return unique_id_ < other.id(); } -#if defined(OS_WIN) - CaptureApiType capture_api_type() const { - return capture_api_class_.capture_api_type(); - } -#endif // if defined(OS_WIN) - private: std::string device_name_; std::string unique_id_; -#if defined(OS_WIN) - // This class wraps the CaptureApiType, so it has a by default value if not - // inititalized, and I (mcasas) do a DCHECK on reading its value. - class CaptureApiClass{ - public: - CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {} - CaptureApiClass(const CaptureApiType api_type) - : capture_api_type_(api_type) {} - CaptureApiType capture_api_type() const { - DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN); - return capture_api_type_; - } - private: - CaptureApiType capture_api_type_; - }; - - CaptureApiClass capture_api_class_; -#endif // if defined(OS_WIN) // Allow generated copy constructor and assignment. }; diff --git a/media/video/capture/video_capture_device_unittest.cc b/media/video/capture/video_capture_device_unittest.cc index 50f4b71..696c51c 100644 --- a/media/video/capture/video_capture_device_unittest.cc +++ b/media/video/capture/video_capture_device_unittest.cc @@ -127,12 +127,7 @@ class VideoCaptureDeviceTest : public testing::Test { }; TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { -#if defined(OS_WIN) - VideoCaptureDevice::Name device_name("jibberish", "jibberish", - VideoCaptureDevice::Name::MEDIA_FOUNDATION); -#else VideoCaptureDevice::Name device_name("jibberish", "jibberish"); -#endif VideoCaptureDevice* device = VideoCaptureDevice::Create(device_name); EXPECT_TRUE(device == NULL); } @@ -149,7 +144,7 @@ TEST_F(VideoCaptureDeviceTest, CaptureVGA) { ASSERT_FALSE(device.get() == NULL); // Get info about the new resolution. - EXPECT_CALL(*frame_observer_, OnFrameInfo(640, 480, _, _)) + EXPECT_CALL(*frame_observer_, OnFrameInfo(640, 480, 30, _)) .Times(1); EXPECT_CALL(*frame_observer_, OnErr()) @@ -259,7 +254,7 @@ TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) { EXPECT_CALL(*frame_observer_, OnErr()) .Times(0); // Get info about the new resolution. - EXPECT_CALL(*frame_observer_, OnFrameInfo(640, 480, 15, _)); + EXPECT_CALL(*frame_observer_, OnFrameInfo(640, 480, 30, _)); device->Allocate(640, 480, 30, frame_observer_.get()); diff --git a/media/video/capture/win/video_capture_device_mf_win.cc b/media/video/capture/win/video_capture_device_mf_win.cc index 5633e3d..d27598b 100644 --- a/media/video/capture/win/video_capture_device_mf_win.cc +++ b/media/video/capture/win/video_capture_device_mf_win.cc @@ -268,8 +268,7 @@ void VideoCaptureDeviceMFWin::GetDeviceNames(Names* device_names) { MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, &id, &id_size))) { std::wstring name_w(name, name_size), id_w(id, id_size); - Name device(base::SysWideToUTF8(name_w), base::SysWideToUTF8(id_w), - Name::MEDIA_FOUNDATION); + Name device(base::SysWideToUTF8(name_w), base::SysWideToUTF8(id_w)); device_names->push_back(device); } else { DLOG(WARNING) << "GetAllocatedString failed: " << std::hex << hr; diff --git a/media/video/capture/win/video_capture_device_win.cc b/media/video/capture/win/video_capture_device_win.cc index 32ac70c..2066066 100644 --- a/media/video/capture/win/video_capture_device_win.cc +++ b/media/video/capture/win/video_capture_device_win.cc @@ -148,40 +148,26 @@ void DeleteMediaType(AM_MEDIA_TYPE* mt) { // static void VideoCaptureDevice::GetDeviceNames(Names* device_names) { - Names::iterator it; - if (VideoCaptureDeviceMFWin::PlatformSupported()) { VideoCaptureDeviceMFWin::GetDeviceNames(device_names); + } else { + VideoCaptureDeviceWin::GetDeviceNames(device_names); } - // Retrieve the devices with DirectShow (DS) interface. They might (partially) - // overlap with the MediaFoundation (MF), so the list has to be consolidated. - Names temp_names; - VideoCaptureDeviceWin::GetDeviceNames(&temp_names); - - // Merge the DS devices into the MF device list, and next remove - // the duplicates, giving priority to the MF "versions". - device_names->merge(temp_names); - device_names->unique(); } // static VideoCaptureDevice* VideoCaptureDevice::Create(const Name& device_name) { VideoCaptureDevice* ret = NULL; - if (device_name.capture_api_type() == Name::MEDIA_FOUNDATION) { - DCHECK(VideoCaptureDeviceMFWin::PlatformSupported()); + if (VideoCaptureDeviceMFWin::PlatformSupported()) { scoped_ptr<VideoCaptureDeviceMFWin> device( new VideoCaptureDeviceMFWin(device_name)); - DVLOG(1) << " MediaFoundation Device: " << device_name.name(); if (device->Init()) ret = device.release(); - } else if (device_name.capture_api_type() == Name::DIRECT_SHOW) { + } else { scoped_ptr<VideoCaptureDeviceWin> device( new VideoCaptureDeviceWin(device_name)); - DVLOG(1) << " DirectShow Device: " << device_name.name(); if (device->Init()) ret = device.release(); - } else{ - NOTREACHED() << " Couldn't recognize VideoCaptureDevice type"; } return ret; @@ -250,7 +236,7 @@ void VideoCaptureDeviceWin::GetDeviceNames(Names* device_names) { id = base::SysWideToUTF8(V_BSTR(&name)); } - device_names->push_back(Name(device_name, id, Name::DIRECT_SHOW)); + device_names->push_back(Name(device_name, id)); } } moniker.Release(); @@ -589,14 +575,10 @@ bool VideoCaptureDeviceWin::CreateCapabilityMap() { capability.color = VideoCaptureCapability::kYUY2; } else if (media_type->subtype == MEDIASUBTYPE_MJPG) { capability.color = VideoCaptureCapability::kMJPEG; - } else if (media_type->subtype == MEDIASUBTYPE_UYVY) { - capability.color = VideoCaptureCapability::kUYVY; - } else if (media_type->subtype == MEDIASUBTYPE_ARGB32) { - capability.color = VideoCaptureCapability::kARGB; } else { WCHAR guid_str[128]; StringFromGUID2(media_type->subtype, guid_str, arraysize(guid_str)); - DVLOG(2) << "Device supports (also) an unknown media type " << guid_str; + DVLOG(2) << "Device support unknown media type " << guid_str; continue; } capabilities_.Add(capability); @@ -614,4 +596,5 @@ void VideoCaptureDeviceWin::SetErrorState(const char* reason) { state_ = kError; observer_->OnError(); } + } // namespace media |