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

Side by Side Diff: media/video/capture/win/video_capture_device_mf_win.cc

Issue 12185022: Fix how we handle an empty capabilities list when enumerating video streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/video/capture/win/video_capture_device_mf_win.h" 5 #include "media/video/capture/win/video_capture_device_mf_win.h"
6 6
7 #include <mfapi.h> 7 #include <mfapi.h>
8 #include <mferror.h> 8 #include <mferror.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ScopedComPtr<IMFMediaType> type; 131 ScopedComPtr<IMFMediaType> type;
132 HRESULT hr; 132 HRESULT hr;
133 while (SUCCEEDED(hr = source->GetNativeMediaType( 133 while (SUCCEEDED(hr = source->GetNativeMediaType(
134 MF_SOURCE_READER_FIRST_VIDEO_STREAM, stream_index, type.Receive()))) { 134 MF_SOURCE_READER_FIRST_VIDEO_STREAM, stream_index, type.Receive()))) {
135 VideoCaptureCapabilityWin capability(stream_index++); 135 VideoCaptureCapabilityWin capability(stream_index++);
136 if (FillCapabilitiesFromType(type, &capability)) 136 if (FillCapabilitiesFromType(type, &capability))
137 capabilities->Add(capability); 137 capabilities->Add(capability);
138 type.Release(); 138 type.Release();
139 } 139 }
140 140
141 if (SUCCEEDED(hr) && capabilities->empty()) 141 if (capabilities->empty() && (SUCCEEDED(hr) || hr == MF_E_NO_MORE_TYPES))
142 hr = HRESULT_FROM_WIN32(ERROR_EMPTY); 142 hr = HRESULT_FROM_WIN32(ERROR_EMPTY);
143 143
144 return (hr == MF_E_NO_MORE_TYPES) ? S_OK : hr; 144 return (hr == MF_E_NO_MORE_TYPES) ? S_OK : hr;
145 } 145 }
146 146
147 bool LoadMediaFoundationDlls() { 147 bool LoadMediaFoundationDlls() {
148 static const wchar_t* const kMfDLLs[] = { 148 static const wchar_t* const kMfDLLs[] = {
149 L"%WINDIR%\\system32\\mf.dll", 149 L"%WINDIR%\\system32\\mf.dll",
150 L"%WINDIR%\\system32\\mfplat.dll", 150 L"%WINDIR%\\system32\\mfplat.dll",
151 L"%WINDIR%\\system32\\mfreadwrite.dll", 151 L"%WINDIR%\\system32\\mfreadwrite.dll",
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 } 420 }
421 421
422 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { 422 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) {
423 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; 423 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr;
424 if (observer_) 424 if (observer_)
425 observer_->OnError(); 425 observer_->OnError();
426 } 426 }
427 427
428 } // namespace media 428 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698