OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
11 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" | 11 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 // NOTE(ajm): Path provided by gyp. | 15 // NOTE(ajm): Path provided by gyp. |
16 #include "libyuv/scale.h" // NOLINT | 16 #include "libyuv/scale.h" // NOLINT |
17 | 17 |
18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
19 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" |
| 20 #include "webrtc/system_wrappers/include/clock.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 const unsigned int kDefaultMinQp = 2; | 24 const unsigned int kDefaultMinQp = 2; |
24 const unsigned int kDefaultMaxQp = 56; | 25 const unsigned int kDefaultMaxQp = 56; |
25 // Max qp for lowest spatial resolution when doing simulcast. | 26 // Max qp for lowest spatial resolution when doing simulcast. |
26 const unsigned int kLowestResMaxQp = 45; | 27 const unsigned int kLowestResMaxQp = 45; |
27 | 28 |
28 uint32_t SumStreamTargetBitrate(int streams, const webrtc::VideoCodec& codec) { | 29 uint32_t SumStreamTargetBitrate(int streams, const webrtc::VideoCodec& codec) { |
29 uint32_t bitrate_sum = 0; | 30 uint32_t bitrate_sum = 0; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const float kTl1MaxTimeToDropFrames = 20.0f; | 96 const float kTl1MaxTimeToDropFrames = 20.0f; |
96 | 97 |
97 struct ScreenshareTemporalLayersFactory : webrtc::TemporalLayersFactory { | 98 struct ScreenshareTemporalLayersFactory : webrtc::TemporalLayersFactory { |
98 ScreenshareTemporalLayersFactory() | 99 ScreenshareTemporalLayersFactory() |
99 : tl1_frame_dropper_(kTl1MaxTimeToDropFrames) {} | 100 : tl1_frame_dropper_(kTl1MaxTimeToDropFrames) {} |
100 | 101 |
101 virtual ~ScreenshareTemporalLayersFactory() {} | 102 virtual ~ScreenshareTemporalLayersFactory() {} |
102 | 103 |
103 virtual webrtc::TemporalLayers* Create(int num_temporal_layers, | 104 virtual webrtc::TemporalLayers* Create(int num_temporal_layers, |
104 uint8_t initial_tl0_pic_idx) const { | 105 uint8_t initial_tl0_pic_idx) const { |
105 return new webrtc::ScreenshareLayers(num_temporal_layers, rand()); | 106 return new webrtc::ScreenshareLayers(num_temporal_layers, rand(), |
| 107 webrtc::Clock::GetRealTimeClock()); |
106 } | 108 } |
107 | 109 |
108 mutable webrtc::FrameDropper tl0_frame_dropper_; | 110 mutable webrtc::FrameDropper tl0_frame_dropper_; |
109 mutable webrtc::FrameDropper tl1_frame_dropper_; | 111 mutable webrtc::FrameDropper tl1_frame_dropper_; |
110 }; | 112 }; |
111 | 113 |
112 // An EncodedImageCallback implementation that forwards on calls to a | 114 // An EncodedImageCallback implementation that forwards on calls to a |
113 // SimulcastEncoderAdapter, but with the stream index it's registered with as | 115 // SimulcastEncoderAdapter, but with the stream index it's registered with as |
114 // the first parameter to Encoded. | 116 // the first parameter to Encoded. |
115 class AdapterEncodedImageCallback : public webrtc::EncodedImageCallback { | 117 class AdapterEncodedImageCallback : public webrtc::EncodedImageCallback { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (streaminfos_.size() != 1) | 501 if (streaminfos_.size() != 1) |
500 return false; | 502 return false; |
501 return streaminfos_[0].encoder->SupportsNativeHandle(); | 503 return streaminfos_[0].encoder->SupportsNativeHandle(); |
502 } | 504 } |
503 | 505 |
504 const char* SimulcastEncoderAdapter::ImplementationName() const { | 506 const char* SimulcastEncoderAdapter::ImplementationName() const { |
505 return implementation_name_.c_str(); | 507 return implementation_name_.c_str(); |
506 } | 508 } |
507 | 509 |
508 } // namespace webrtc | 510 } // namespace webrtc |
OLD | NEW |