OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 int32_t VCMGenericEncoder::Release() { | 38 int32_t VCMGenericEncoder::Release() { |
39 TRACE_EVENT0("webrtc", "VCMGenericEncoder::Release"); | 39 TRACE_EVENT0("webrtc", "VCMGenericEncoder::Release"); |
40 return encoder_->Release(); | 40 return encoder_->Release(); |
41 } | 41 } |
42 | 42 |
43 int32_t VCMGenericEncoder::InitEncode(const VideoCodec* settings, | 43 int32_t VCMGenericEncoder::InitEncode(const VideoCodec* settings, |
44 int32_t number_of_cores, | 44 int32_t number_of_cores, |
45 size_t max_payload_size) { | 45 size_t max_payload_size) { |
46 TRACE_EVENT0("webrtc", "VCMGenericEncoder::InitEncode"); | 46 TRACE_EVENT0("webrtc", "VCMGenericEncoder::InitEncode"); |
47 { | |
48 rtc::CritScope lock(¶ms_lock_); | |
49 encoder_params_.target_bitrate = settings->startBitrate * 1000; | |
50 encoder_params_.input_frame_rate = settings->maxFramerate; | |
51 } | |
52 | |
53 is_screenshare_ = settings->mode == VideoCodecMode::kScreensharing; | 47 is_screenshare_ = settings->mode == VideoCodecMode::kScreensharing; |
54 if (encoder_->InitEncode(settings, number_of_cores, max_payload_size) != 0) { | 48 if (encoder_->InitEncode(settings, number_of_cores, max_payload_size) != 0) { |
55 LOG(LS_ERROR) << "Failed to initialize the encoder associated with " | 49 LOG(LS_ERROR) << "Failed to initialize the encoder associated with " |
56 "payload name: " | 50 "payload name: " |
57 << settings->plName; | 51 << settings->plName; |
58 return -1; | 52 return -1; |
59 } | 53 } |
60 encoder_->RegisterEncodeCompleteCallback(vcm_encoded_frame_callback_); | 54 encoder_->RegisterEncodeCompleteCallback(vcm_encoded_frame_callback_); |
61 return 0; | 55 return 0; |
62 } | 56 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 153 |
160 if (media_opt_) { | 154 if (media_opt_) { |
161 media_opt_->UpdateWithEncodedData(encoded_image); | 155 media_opt_->UpdateWithEncodedData(encoded_image); |
162 if (internal_source_) | 156 if (internal_source_) |
163 return media_opt_->DropFrame(); // Signal to encoder to drop next frame. | 157 return media_opt_->DropFrame(); // Signal to encoder to drop next frame. |
164 } | 158 } |
165 return VCM_OK; | 159 return VCM_OK; |
166 } | 160 } |
167 | 161 |
168 } // namespace webrtc | 162 } // namespace webrtc |
OLD | NEW |