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

Side by Side Diff: media/gpu/media_foundation_video_encode_accelerator_win.cc

Issue 2887243002: Remove ScopedComPtr::CreateInstance() (Closed)
Patch Set: Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/gpu/media_foundation_video_encode_accelerator_win.h" 5 #include "media/gpu/media_foundation_video_encode_accelerator_win.h"
6 6
7 #pragma warning(push) 7 #pragma warning(push)
8 #pragma warning(disable : 4800) // Disable warning for added padding. 8 #pragma warning(disable : 4800) // Disable warning for added padding.
9 9
10 #include <codecapi.h> 10 #include <codecapi.h>
11 #include <mferror.h> 11 #include <mferror.h>
12 #include <mftransform.h> 12 #include <mftransform.h>
13 #include <objbase.h>
13 14
14 #include <iterator> 15 #include <iterator>
15 #include <utility> 16 #include <utility>
16 #include <vector> 17 #include <vector>
17 18
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
20 #include "base/win/scoped_co_mem.h" 21 #include "base/win/scoped_co_mem.h"
21 #include "base/win/scoped_variant.h" 22 #include "base/win/scoped_variant.h"
22 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 output_info.guidMajorType = MFMediaType_Video; 349 output_info.guidMajorType = MFMediaType_Video;
349 output_info.guidSubtype = MFVideoFormat_H264; 350 output_info.guidSubtype = MFVideoFormat_H264;
350 351
351 base::win::ScopedCoMem<CLSID> CLSIDs; 352 base::win::ScopedCoMem<CLSID> CLSIDs;
352 uint32_t count = 0; 353 uint32_t count = 0;
353 HRESULT hr = MFTEnum(MFT_CATEGORY_VIDEO_ENCODER, flags, &input_info, 354 HRESULT hr = MFTEnum(MFT_CATEGORY_VIDEO_ENCODER, flags, &input_info,
354 &output_info, NULL, &CLSIDs, &count); 355 &output_info, NULL, &CLSIDs, &count);
355 RETURN_ON_HR_FAILURE(hr, "Couldn't enumerate hardware encoder", false); 356 RETURN_ON_HR_FAILURE(hr, "Couldn't enumerate hardware encoder", false);
356 RETURN_ON_FAILURE((count > 0), "No HW encoder found", false); 357 RETURN_ON_FAILURE((count > 0), "No HW encoder found", false);
357 DVLOG(3) << "HW encoder(s) found: " << count; 358 DVLOG(3) << "HW encoder(s) found: " << count;
358 hr = encoder_.CreateInstance(CLSIDs[0]); 359 hr = ::CoCreateInstance(CLSIDs[0], nullptr, CLSCTX_ALL,
360 IID_PPV_ARGS(&encoder_));
359 RETURN_ON_HR_FAILURE(hr, "Couldn't activate hardware encoder", false); 361 RETURN_ON_HR_FAILURE(hr, "Couldn't activate hardware encoder", false);
360 RETURN_ON_FAILURE((encoder_.Get() != nullptr), 362 RETURN_ON_FAILURE((encoder_.Get() != nullptr),
361 "No HW encoder instance created", false); 363 "No HW encoder instance created", false);
362 return true; 364 return true;
363 } 365 }
364 366
365 bool MediaFoundationVideoEncodeAccelerator::InitializeInputOutputSamples() { 367 bool MediaFoundationVideoEncodeAccelerator::InitializeInputOutputSamples() {
366 DCHECK(main_client_task_runner_->BelongsToCurrentThread()); 368 DCHECK(main_client_task_runner_->BelongsToCurrentThread());
367 369
368 DWORD input_count = 0; 370 DWORD input_count = 0;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 void MediaFoundationVideoEncodeAccelerator::ReleaseEncoderResources() { 698 void MediaFoundationVideoEncodeAccelerator::ReleaseEncoderResources() {
697 encoder_.Reset(); 699 encoder_.Reset();
698 codec_api_.Reset(); 700 codec_api_.Reset();
699 imf_input_media_type_.Reset(); 701 imf_input_media_type_.Reset();
700 imf_output_media_type_.Reset(); 702 imf_output_media_type_.Reset();
701 input_sample_.Reset(); 703 input_sample_.Reset();
702 output_sample_.Reset(); 704 output_sample_.Reset();
703 } 705 }
704 706
705 } // namespace content 707 } // namespace content
OLDNEW
« no previous file with comments | « media/capture/video/win/video_capture_device_win.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698