OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 */ | 10 */ |
(...skipping 30 matching lines...) Expand all Loading... |
41 // see crbug.com/583348. Until further investigated, only use one thread. | 41 // see crbug.com/583348. Until further investigated, only use one thread. |
42 // if (width * height >= 1920 * 1080 && number_of_cores > 8) { | 42 // if (width * height >= 1920 * 1080 && number_of_cores > 8) { |
43 // return 8; // 8 threads for 1080p on high perf machines. | 43 // return 8; // 8 threads for 1080p on high perf machines. |
44 // } else if (width * height > 1280 * 960 && number_of_cores >= 6) { | 44 // } else if (width * height > 1280 * 960 && number_of_cores >= 6) { |
45 // return 3; // 3 threads for 1080p. | 45 // return 3; // 3 threads for 1080p. |
46 // } else if (width * height > 640 * 480 && number_of_cores >= 3) { | 46 // } else if (width * height > 640 * 480 && number_of_cores >= 3) { |
47 // return 2; // 2 threads for qHD/HD. | 47 // return 2; // 2 threads for qHD/HD. |
48 // } else { | 48 // } else { |
49 // return 1; // 1 thread for VGA or less. | 49 // return 1; // 1 thread for VGA or less. |
50 // } | 50 // } |
| 51 // TODO(sprang): Also check sSliceArgument.uiSliceNum om GetEncoderPrams(), |
| 52 // before enabling multithreading here. |
51 return 1; | 53 return 1; |
52 } | 54 } |
53 | 55 |
54 FrameType ConvertToVideoFrameType(EVideoFrameType type) { | 56 FrameType ConvertToVideoFrameType(EVideoFrameType type) { |
55 switch (type) { | 57 switch (type) { |
56 case videoFrameTypeIDR: | 58 case videoFrameTypeIDR: |
57 return kVideoFrameKey; | 59 return kVideoFrameKey; |
58 case videoFrameTypeSkip: | 60 case videoFrameTypeSkip: |
59 case videoFrameTypeI: | 61 case videoFrameTypeI: |
60 case videoFrameTypeP: | 62 case videoFrameTypeP: |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 encoder_params.sSpatialLayers[0].iSpatialBitrate = | 440 encoder_params.sSpatialLayers[0].iSpatialBitrate = |
439 encoder_params.iTargetBitrate; | 441 encoder_params.iTargetBitrate; |
440 encoder_params.sSpatialLayers[0].iMaxSpatialBitrate = | 442 encoder_params.sSpatialLayers[0].iMaxSpatialBitrate = |
441 encoder_params.iMaxBitrate; | 443 encoder_params.iMaxBitrate; |
442 #if (OPENH264_MAJOR == 1) && (OPENH264_MINOR <= 5) | 444 #if (OPENH264_MAJOR == 1) && (OPENH264_MINOR <= 5) |
443 // Slice num according to number of threads. | 445 // Slice num according to number of threads. |
444 encoder_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_AUTO_SLICE; | 446 encoder_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_AUTO_SLICE; |
445 #else | 447 #else |
446 // When uiSliceMode = SM_FIXEDSLCNUM_SLICE, uiSliceNum = 0 means auto design | 448 // When uiSliceMode = SM_FIXEDSLCNUM_SLICE, uiSliceNum = 0 means auto design |
447 // it with cpu core number. | 449 // it with cpu core number. |
448 encoder_params.sSpatialLayers[0].sSliceArgument.uiSliceNum = 0; | 450 // TODO(sprang): Set to 0 when we understand why the rate controller borks |
| 451 // when uiSliceNum > 1. |
| 452 encoder_params.sSpatialLayers[0].sSliceArgument.uiSliceNum = 1; |
449 encoder_params.sSpatialLayers[0].sSliceArgument.uiSliceMode = | 453 encoder_params.sSpatialLayers[0].sSliceArgument.uiSliceMode = |
450 SM_FIXEDSLCNUM_SLICE; | 454 SM_FIXEDSLCNUM_SLICE; |
451 #endif | 455 #endif |
452 | 456 |
453 return encoder_params; | 457 return encoder_params; |
454 } | 458 } |
455 | 459 |
456 void H264EncoderImpl::ReportInit() { | 460 void H264EncoderImpl::ReportInit() { |
457 if (has_reported_init_) | 461 if (has_reported_init_) |
458 return; | 462 return; |
(...skipping 19 matching lines...) Expand all Loading... |
478 | 482 |
479 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 483 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
480 return WEBRTC_VIDEO_CODEC_OK; | 484 return WEBRTC_VIDEO_CODEC_OK; |
481 } | 485 } |
482 | 486 |
483 void H264EncoderImpl::OnDroppedFrame() { | 487 void H264EncoderImpl::OnDroppedFrame() { |
484 quality_scaler_.ReportDroppedFrame(); | 488 quality_scaler_.ReportDroppedFrame(); |
485 } | 489 } |
486 | 490 |
487 } // namespace webrtc | 491 } // namespace webrtc |
OLD | NEW |