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

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

Issue 2137453003: mac: Remove IsOSMavericksOrLater() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cfallocator_1012
Patch Set: rebase Created 4 years, 5 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/vt_video_encode_accelerator_mac.h" 5 #include "media/gpu/vt_video_encode_accelerator_mac.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/mac/mac_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
11 #include "media/base/mac/coremedia_glue.h" 10 #include "media/base/mac/coremedia_glue.h"
12 #include "media/base/mac/corevideo_glue.h" 11 #include "media/base/mac/corevideo_glue.h"
13 #include "media/base/mac/video_frame_mac.h" 12 #include "media/base/mac/video_frame_mac.h"
14 #include "third_party/webrtc/system_wrappers/include/clock.h" 13 #include "third_party/webrtc/system_wrappers/include/clock.h"
15 14
16 namespace media { 15 namespace media {
17 16
18 namespace { 17 namespace {
19 18
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 DVLOG(3) << __FUNCTION__; 98 DVLOG(3) << __FUNCTION__;
100 DCHECK(thread_checker_.CalledOnValidThread()); 99 DCHECK(thread_checker_.CalledOnValidThread());
101 100
102 SupportedProfiles profiles; 101 SupportedProfiles profiles;
103 // Check if HW encoder is supported initially. 102 // Check if HW encoder is supported initially.
104 videotoolbox_glue_ = VideoToolboxGlue::Get(); 103 videotoolbox_glue_ = VideoToolboxGlue::Get();
105 if (!videotoolbox_glue_) { 104 if (!videotoolbox_glue_) {
106 DLOG(ERROR) << "Failed creating VideoToolbox glue."; 105 DLOG(ERROR) << "Failed creating VideoToolbox glue.";
107 return profiles; 106 return profiles;
108 } 107 }
109 if (!base::mac::IsOSMavericksOrLater()) {
110 DLOG(ERROR) << "VideoToolbox hardware encoder is supported on Mac OS 10.9 "
111 "and later.";
112 return profiles;
113 }
114 const bool rv = CreateCompressionSession( 108 const bool rv = CreateCompressionSession(
115 video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0), 109 video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0),
116 gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true); 110 gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true);
117 DestroyCompressionSession(); 111 DestroyCompressionSession();
118 if (!rv) { 112 if (!rv) {
119 VLOG(1) 113 VLOG(1)
120 << "Hardware encode acceleration is not available on this platform."; 114 << "Hardware encode acceleration is not available on this platform.";
121 return profiles; 115 return profiles;
122 } 116 }
123 117
(...skipping 27 matching lines...) Expand all
151 if (H264PROFILE_BASELINE != output_profile) { 145 if (H264PROFILE_BASELINE != output_profile) {
152 DLOG(ERROR) << "Output profile not supported= " << output_profile; 146 DLOG(ERROR) << "Output profile not supported= " << output_profile;
153 return false; 147 return false;
154 } 148 }
155 149
156 videotoolbox_glue_ = VideoToolboxGlue::Get(); 150 videotoolbox_glue_ = VideoToolboxGlue::Get();
157 if (!videotoolbox_glue_) { 151 if (!videotoolbox_glue_) {
158 DLOG(ERROR) << "Failed creating VideoToolbox glue."; 152 DLOG(ERROR) << "Failed creating VideoToolbox glue.";
159 return false; 153 return false;
160 } 154 }
161 if (!base::mac::IsOSMavericksOrLater()) {
162 DLOG(ERROR) << "VideoToolbox hardware encoder is supported on Mac OS 10.9 "
163 "and later.";
164 return false;
165 }
166 155
167 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); 156 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
168 client_ = client_ptr_factory_->GetWeakPtr(); 157 client_ = client_ptr_factory_->GetWeakPtr();
169 input_visible_size_ = input_visible_size; 158 input_visible_size_ = input_visible_size;
170 frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator; 159 frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator;
171 initial_bitrate_ = initial_bitrate; 160 initial_bitrate_ = initial_bitrate;
172 bitstream_buffer_size_ = input_visible_size.GetArea(); 161 bitstream_buffer_size_ = input_visible_size.GetArea();
173 162
174 if (!encoder_thread_.Start()) { 163 if (!encoder_thread_.Start()) {
175 DLOG(ERROR) << "Failed spawning encoder thread."; 164 DLOG(ERROR) << "Failed spawning encoder thread.";
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 (encoder_thread_.IsRunning() && 568 (encoder_thread_.IsRunning() &&
580 encoder_thread_task_runner_->BelongsToCurrentThread())); 569 encoder_thread_task_runner_->BelongsToCurrentThread()));
581 570
582 if (compression_session_) { 571 if (compression_session_) {
583 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); 572 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_);
584 compression_session_.reset(); 573 compression_session_.reset();
585 } 574 }
586 } 575 }
587 576
588 } // namespace media 577 } // namespace media
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.mm ('k') | ui/base/cocoa/remote_layer_api.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698