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