OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/media/video_track_recorder.h" | 5 #include "content/renderer/media/video_track_recorder.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 init_params.iRCMode = RC_BITRATE_MODE; | 1016 init_params.iRCMode = RC_BITRATE_MODE; |
1017 init_params.iTargetBitrate = bits_per_second_; | 1017 init_params.iTargetBitrate = bits_per_second_; |
1018 } else { | 1018 } else { |
1019 init_params.iRCMode = RC_OFF_MODE; | 1019 init_params.iRCMode = RC_OFF_MODE; |
1020 } | 1020 } |
1021 | 1021 |
1022 // Threading model: Set to 1 due to https://crbug.com/583348. | 1022 // Threading model: Set to 1 due to https://crbug.com/583348. |
1023 init_params.iMultipleThreadIdc = 1; | 1023 init_params.iMultipleThreadIdc = 1; |
1024 | 1024 |
1025 // TODO(mcasas): consider reducing complexity if there are few CPUs available. | 1025 // TODO(mcasas): consider reducing complexity if there are few CPUs available. |
1026 init_params.iComplexityMode = MEDIUM_COMPLEXITY; | 1026 DCHECK_EQ(MEDIUM_COMPLEXITY, init_params.iComplexityMode); |
1027 DCHECK(!init_params.bEnableDenoise); | 1027 DCHECK(!init_params.bEnableDenoise); |
1028 DCHECK(init_params.bEnableFrameSkip); | 1028 DCHECK(init_params.bEnableFrameSkip); |
1029 | 1029 |
1030 // The base spatial layer 0 is the only one we use. | 1030 // The base spatial layer 0 is the only one we use. |
1031 DCHECK_EQ(1, init_params.iSpatialLayerNum); | 1031 DCHECK_EQ(1, init_params.iSpatialLayerNum); |
1032 init_params.sSpatialLayers[0].iVideoWidth = init_params.iPicWidth; | 1032 init_params.sSpatialLayers[0].iVideoWidth = init_params.iPicWidth; |
1033 init_params.sSpatialLayers[0].iVideoHeight = init_params.iPicHeight; | 1033 init_params.sSpatialLayers[0].iVideoHeight = init_params.iPicHeight; |
1034 init_params.sSpatialLayers[0].iSpatialBitrate = init_params.iTargetBitrate; | 1034 init_params.sSpatialLayers[0].iSpatialBitrate = init_params.iTargetBitrate; |
1035 | 1035 // Slice num according to number of threads. |
1036 // When uiSliceMode = SM_FIXEDSLCNUM_SLICE, uiSliceNum = 0 means auto design | 1036 init_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_AUTO_SLICE; |
1037 // it with cpu core number. | |
1038 init_params.sSpatialLayers[0].sSliceArgument.uiSliceNum = 0; | |
1039 init_params.sSpatialLayers[0].sSliceArgument.uiSliceMode = | |
1040 SM_FIXEDSLCNUM_SLICE; | |
1041 | 1037 |
1042 if (openh264_encoder_->InitializeExt(&init_params) != cmResultSuccess) { | 1038 if (openh264_encoder_->InitializeExt(&init_params) != cmResultSuccess) { |
1043 NOTREACHED() << "Failed to initialize OpenH264 encoder"; | 1039 NOTREACHED() << "Failed to initialize OpenH264 encoder"; |
1044 return; | 1040 return; |
1045 } | 1041 } |
1046 | 1042 |
1047 int pixel_format = EVideoFormatType::videoFormatI420; | 1043 int pixel_format = EVideoFormatType::videoFormatI420; |
1048 openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT, &pixel_format); | 1044 openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT, &pixel_format); |
1049 } | 1045 } |
1050 #endif //#if BUILDFLAG(RTC_USE_H264) | 1046 #endif //#if BUILDFLAG(RTC_USE_H264) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 encoder_->SetPaused(paused_before_init_); | 1143 encoder_->SetPaused(paused_before_init_); |
1148 | 1144 |
1149 // StartFrameEncode() will be called on Render IO thread. | 1145 // StartFrameEncode() will be called on Render IO thread. |
1150 MediaStreamVideoSink::ConnectToTrack( | 1146 MediaStreamVideoSink::ConnectToTrack( |
1151 track_, | 1147 track_, |
1152 base::Bind(&VideoTrackRecorder::Encoder::StartFrameEncode, encoder_), | 1148 base::Bind(&VideoTrackRecorder::Encoder::StartFrameEncode, encoder_), |
1153 false); | 1149 false); |
1154 } | 1150 } |
1155 | 1151 |
1156 } // namespace content | 1152 } // namespace content |
OLD | NEW |