| OLD | NEW |
| 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 "content/common/gpu/media/vt_video_encode_accelerator_mac.h" | 5 #include "content/common/gpu/media/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/thread_task_runner_handle.h" | 9 #include "base/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 | 13 |
| 15 namespace content { | 14 namespace content { |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 // TODO(emircan): Check if we can find the actual system capabilities via | 18 // TODO(emircan): Check if we can find the actual system capabilities via |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 DVLOG(3) << __FUNCTION__; | 84 DVLOG(3) << __FUNCTION__; |
| 86 DCHECK(thread_checker_.CalledOnValidThread()); | 85 DCHECK(thread_checker_.CalledOnValidThread()); |
| 87 | 86 |
| 88 SupportedProfiles profiles; | 87 SupportedProfiles profiles; |
| 89 // Check if HW encoder is supported initially. | 88 // Check if HW encoder is supported initially. |
| 90 videotoolbox_glue_ = VideoToolboxGlue::Get(); | 89 videotoolbox_glue_ = VideoToolboxGlue::Get(); |
| 91 if (!videotoolbox_glue_) { | 90 if (!videotoolbox_glue_) { |
| 92 DLOG(ERROR) << "Failed creating VideoToolbox glue."; | 91 DLOG(ERROR) << "Failed creating VideoToolbox glue."; |
| 93 return profiles; | 92 return profiles; |
| 94 } | 93 } |
| 95 if (!base::mac::IsOSMavericksOrLater()) { | |
| 96 DLOG(ERROR) << "VideoToolbox hardware encoder is supported on Mac OS 10.9 " | |
| 97 "and later."; | |
| 98 return profiles; | |
| 99 } | |
| 100 const bool rv = CreateCompressionSession( | 94 const bool rv = CreateCompressionSession( |
| 101 media::video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0), | 95 media::video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0), |
| 102 gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true); | 96 gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true); |
| 103 DestroyCompressionSession(); | 97 DestroyCompressionSession(); |
| 104 if (!rv) { | 98 if (!rv) { |
| 105 VLOG(1) | 99 VLOG(1) |
| 106 << "Hardware encode acceleration is not available on this platform."; | 100 << "Hardware encode acceleration is not available on this platform."; |
| 107 return profiles; | 101 return profiles; |
| 108 } | 102 } |
| 109 | 103 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 (encoder_thread_.IsRunning() && | 545 (encoder_thread_.IsRunning() && |
| 552 encoder_thread_task_runner_->BelongsToCurrentThread())); | 546 encoder_thread_task_runner_->BelongsToCurrentThread())); |
| 553 | 547 |
| 554 if (compression_session_) { | 548 if (compression_session_) { |
| 555 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); | 549 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); |
| 556 compression_session_.reset(); | 550 compression_session_.reset(); |
| 557 } | 551 } |
| 558 } | 552 } |
| 559 | 553 |
| 560 } // namespace content | 554 } // namespace content |
| OLD | NEW |