| 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   DCHECK_EQ(MEDIUM_COMPLEXITY, init_params.iComplexityMode); |  1026   init_params.iComplexityMode = MEDIUM_COMPLEXITY; | 
|  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   // Slice num according to number of threads. |  1035  | 
|  1036   init_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_AUTO_SLICE; |  1036   // When uiSliceMode = SM_FIXEDSLCNUM_SLICE, uiSliceNum = 0 means auto design | 
 |  1037   // it with cpu core number. | 
 |  1038   // TODO(sprang): Set to 0 when we understand why the rate controller borks | 
 |  1039   // when uiSliceNum > 1. See https://github.com/cisco/openh264/issues/2591 | 
 |  1040   init_params.sSpatialLayers[0].sSliceArgument.uiSliceNum = 1; | 
 |  1041   init_params.sSpatialLayers[0].sSliceArgument.uiSliceMode = | 
 |  1042       SM_FIXEDSLCNUM_SLICE; | 
|  1037  |  1043  | 
|  1038   if (openh264_encoder_->InitializeExt(&init_params) != cmResultSuccess) { |  1044   if (openh264_encoder_->InitializeExt(&init_params) != cmResultSuccess) { | 
|  1039     NOTREACHED() << "Failed to initialize OpenH264 encoder"; |  1045     NOTREACHED() << "Failed to initialize OpenH264 encoder"; | 
|  1040     return; |  1046     return; | 
|  1041   } |  1047   } | 
|  1042  |  1048  | 
|  1043   int pixel_format = EVideoFormatType::videoFormatI420; |  1049   int pixel_format = EVideoFormatType::videoFormatI420; | 
|  1044   openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT, &pixel_format); |  1050   openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT, &pixel_format); | 
|  1045 } |  1051 } | 
|  1046 #endif //#if BUILDFLAG(RTC_USE_H264) |  1052 #endif //#if BUILDFLAG(RTC_USE_H264) | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1143     encoder_->SetPaused(paused_before_init_); |  1149     encoder_->SetPaused(paused_before_init_); | 
|  1144  |  1150  | 
|  1145   // StartFrameEncode() will be called on Render IO thread. |  1151   // StartFrameEncode() will be called on Render IO thread. | 
|  1146   MediaStreamVideoSink::ConnectToTrack( |  1152   MediaStreamVideoSink::ConnectToTrack( | 
|  1147       track_, |  1153       track_, | 
|  1148       base::Bind(&VideoTrackRecorder::Encoder::StartFrameEncode, encoder_), |  1154       base::Bind(&VideoTrackRecorder::Encoder::StartFrameEncode, encoder_), | 
|  1149       false); |  1155       false); | 
|  1150 } |  1156 } | 
|  1151  |  1157  | 
|  1152 }  // namespace content |  1158 }  // namespace content | 
| OLD | NEW |