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

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

Issue 1950563006: Reland: Tie kWebRtcH264WithOpenH264FFmpeg and kEnableWebRtcHWH264Encoding flags on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « content/renderer/media/rtc_video_encoder_factory.cc ('k') | 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 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"
9 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
10 #include "media/base/mac/coremedia_glue.h" 11 #include "media/base/mac/coremedia_glue.h"
11 #include "media/base/mac/corevideo_glue.h" 12 #include "media/base/mac/corevideo_glue.h"
12 #include "media/base/mac/video_frame_mac.h" 13 #include "media/base/mac/video_frame_mac.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 namespace { 17 namespace {
17 18
18 // TODO(emircan): Check if we can find the actual system capabilities via 19 // TODO(emircan): Check if we can find the actual system capabilities via
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 DVLOG(3) << __FUNCTION__; 84 DVLOG(3) << __FUNCTION__;
84 DCHECK(thread_checker_.CalledOnValidThread()); 85 DCHECK(thread_checker_.CalledOnValidThread());
85 86
86 SupportedProfiles profiles; 87 SupportedProfiles profiles;
87 // Check if HW encoder is supported initially. 88 // Check if HW encoder is supported initially.
88 videotoolbox_glue_ = VideoToolboxGlue::Get(); 89 videotoolbox_glue_ = VideoToolboxGlue::Get();
89 if (!videotoolbox_glue_) { 90 if (!videotoolbox_glue_) {
90 DLOG(ERROR) << "Failed creating VideoToolbox glue."; 91 DLOG(ERROR) << "Failed creating VideoToolbox glue.";
91 return profiles; 92 return profiles;
92 } 93 }
94 if (!base::mac::IsOSMavericksOrLater()) {
95 DLOG(ERROR) << "VideoToolbox hardware encoder is supported on Mac OS 10.9 "
96 "and later.";
97 return profiles;
98 }
93 const bool rv = CreateCompressionSession( 99 const bool rv = CreateCompressionSession(
94 media::video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0), 100 media::video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0),
95 gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true); 101 gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true);
96 DestroyCompressionSession(); 102 DestroyCompressionSession();
97 if (!rv) { 103 if (!rv) {
98 VLOG(1) 104 VLOG(1)
99 << "Hardware encode acceleration is not available on this platform."; 105 << "Hardware encode acceleration is not available on this platform.";
100 return profiles; 106 return profiles;
101 } 107 }
102 108
(...skipping 28 matching lines...) Expand all
131 if (media::H264PROFILE_BASELINE != output_profile) { 137 if (media::H264PROFILE_BASELINE != output_profile) {
132 DLOG(ERROR) << "Output profile not supported= " << output_profile; 138 DLOG(ERROR) << "Output profile not supported= " << output_profile;
133 return false; 139 return false;
134 } 140 }
135 141
136 videotoolbox_glue_ = VideoToolboxGlue::Get(); 142 videotoolbox_glue_ = VideoToolboxGlue::Get();
137 if (!videotoolbox_glue_) { 143 if (!videotoolbox_glue_) {
138 DLOG(ERROR) << "Failed creating VideoToolbox glue."; 144 DLOG(ERROR) << "Failed creating VideoToolbox glue.";
139 return false; 145 return false;
140 } 146 }
147 if (!base::mac::IsOSMavericksOrLater()) {
148 DLOG(ERROR) << "VideoToolbox hardware encoder is supported on Mac OS 10.9 "
149 "and later.";
150 return false;
151 }
141 152
142 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); 153 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
143 client_ = client_ptr_factory_->GetWeakPtr(); 154 client_ = client_ptr_factory_->GetWeakPtr();
144 input_visible_size_ = input_visible_size; 155 input_visible_size_ = input_visible_size;
145 frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator; 156 frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator;
146 target_bitrate_ = initial_bitrate; 157 target_bitrate_ = initial_bitrate;
147 bitstream_buffer_size_ = input_visible_size.GetArea(); 158 bitstream_buffer_size_ = input_visible_size.GetArea();
148 159
149 if (!encoder_thread_.Start()) { 160 if (!encoder_thread_.Start()) {
150 DLOG(ERROR) << "Failed spawning encoder thread."; 161 DLOG(ERROR) << "Failed spawning encoder thread.";
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 (encoder_thread_.IsRunning() && 547 (encoder_thread_.IsRunning() &&
537 encoder_thread_task_runner_->BelongsToCurrentThread())); 548 encoder_thread_task_runner_->BelongsToCurrentThread()));
538 549
539 if (compression_session_) { 550 if (compression_session_) {
540 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); 551 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_);
541 compression_session_.reset(); 552 compression_session_.reset();
542 } 553 }
543 } 554 }
544 555
545 } // namespace media 556 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_encoder_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698