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 "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/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "media/base/mac/coremedia_glue.h" | 10 #include "media/base/mac/coremedia_glue.h" |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 compression_session_, videotoolbox_glue_); | 553 compression_session_, videotoolbox_glue_); |
554 bool rv = true; | 554 bool rv = true; |
555 rv &= session_property_setter.Set( | 555 rv &= session_property_setter.Set( |
556 videotoolbox_glue_->kVTCompressionPropertyKey_ProfileLevel(), | 556 videotoolbox_glue_->kVTCompressionPropertyKey_ProfileLevel(), |
557 videotoolbox_glue_->kVTProfileLevel_H264_Baseline_AutoLevel()); | 557 videotoolbox_glue_->kVTProfileLevel_H264_Baseline_AutoLevel()); |
558 rv &= session_property_setter.Set( | 558 rv &= session_property_setter.Set( |
559 videotoolbox_glue_->kVTCompressionPropertyKey_RealTime(), true); | 559 videotoolbox_glue_->kVTCompressionPropertyKey_RealTime(), true); |
560 rv &= session_property_setter.Set( | 560 rv &= session_property_setter.Set( |
561 videotoolbox_glue_->kVTCompressionPropertyKey_AllowFrameReordering(), | 561 videotoolbox_glue_->kVTCompressionPropertyKey_AllowFrameReordering(), |
562 false); | 562 false); |
| 563 // Limit keyframe output to 4 minutes, see crbug.com/658429. |
| 564 rv &= session_property_setter.Set( |
| 565 videotoolbox_glue_->kVTCompressionPropertyKey_MaxKeyFrameInterval(), |
| 566 7200); |
| 567 rv &= session_property_setter.Set( |
| 568 videotoolbox_glue_ |
| 569 ->kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration(), |
| 570 240); |
563 DLOG_IF(ERROR, !rv) << " Setting session property failed."; | 571 DLOG_IF(ERROR, !rv) << " Setting session property failed."; |
564 return rv; | 572 return rv; |
565 } | 573 } |
566 | 574 |
567 void VTVideoEncodeAccelerator::DestroyCompressionSession() { | 575 void VTVideoEncodeAccelerator::DestroyCompressionSession() { |
568 DCHECK(thread_checker_.CalledOnValidThread() || | 576 DCHECK(thread_checker_.CalledOnValidThread() || |
569 (encoder_thread_.IsRunning() && | 577 (encoder_thread_.IsRunning() && |
570 encoder_thread_task_runner_->BelongsToCurrentThread())); | 578 encoder_thread_task_runner_->BelongsToCurrentThread())); |
571 | 579 |
572 if (compression_session_) { | 580 if (compression_session_) { |
573 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); | 581 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); |
574 compression_session_.reset(); | 582 compression_session_.reset(); |
575 } | 583 } |
576 } | 584 } |
577 | 585 |
578 } // namespace media | 586 } // namespace media |
OLD | NEW |