Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: webrtc/modules/video_coding/generic_encoder.cc

Issue 1900193004: Remove VCMPacketizationCallback (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed offline comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 const CodecSpecificInfo* codec_specific, 65 const CodecSpecificInfo* codec_specific,
66 const std::vector<FrameType>& frame_types) { 66 const std::vector<FrameType>& frame_types) {
67 TRACE_EVENT1("webrtc", "VCMGenericEncoder::Encode", "timestamp", 67 TRACE_EVENT1("webrtc", "VCMGenericEncoder::Encode", "timestamp",
68 frame.timestamp()); 68 frame.timestamp());
69 69
70 for (FrameType frame_type : frame_types) 70 for (FrameType frame_type : frame_types)
71 RTC_DCHECK(frame_type == kVideoFrameKey || frame_type == kVideoFrameDelta); 71 RTC_DCHECK(frame_type == kVideoFrameKey || frame_type == kVideoFrameDelta);
72 72
73 int32_t result = encoder_->Encode(frame, codec_specific, &frame_types); 73 int32_t result = encoder_->Encode(frame, codec_specific, &frame_types);
74 74
75 if (vcm_encoded_frame_callback_) {
76 vcm_encoded_frame_callback_->SignalLastEncoderImplementationUsed(
77 encoder_->ImplementationName());
78 }
79
80 if (is_screenshare_ && 75 if (is_screenshare_ &&
81 result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) { 76 result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) {
82 // Target bitrate exceeded, encoder state has been reset - try again. 77 // Target bitrate exceeded, encoder state has been reset - try again.
83 return encoder_->Encode(frame, codec_specific, &frame_types); 78 return encoder_->Encode(frame, codec_specific, &frame_types);
84 } 79 }
85 80
86 return result; 81 return result;
87 } 82 }
88 83
84 const char* VCMGenericEncoder::ImplementationName() const {
85 return encoder_->ImplementationName();
86 }
87
89 void VCMGenericEncoder::SetEncoderParameters(const EncoderParameters& params) { 88 void VCMGenericEncoder::SetEncoderParameters(const EncoderParameters& params) {
90 bool channel_parameters_have_changed; 89 bool channel_parameters_have_changed;
91 bool rates_have_changed; 90 bool rates_have_changed;
92 { 91 {
93 rtc::CritScope lock(&params_lock_); 92 rtc::CritScope lock(&params_lock_);
94 channel_parameters_have_changed = 93 channel_parameters_have_changed =
95 params.loss_rate != encoder_params_.loss_rate || 94 params.loss_rate != encoder_params_.loss_rate ||
96 params.rtt != encoder_params_.rtt; 95 params.rtt != encoder_params_.rtt;
97 rates_have_changed = 96 rates_have_changed =
98 params.target_bitrate != encoder_params_.target_bitrate || 97 params.target_bitrate != encoder_params_.target_bitrate ||
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 bool VCMGenericEncoder::SupportsNativeHandle() const { 136 bool VCMGenericEncoder::SupportsNativeHandle() const {
138 return encoder_->SupportsNativeHandle(); 137 return encoder_->SupportsNativeHandle();
139 } 138 }
140 139
141 int VCMGenericEncoder::GetTargetFramerate() { 140 int VCMGenericEncoder::GetTargetFramerate() {
142 return encoder_->GetTargetFramerate(); 141 return encoder_->GetTargetFramerate();
143 } 142 }
144 143
145 VCMEncodedFrameCallback::VCMEncodedFrameCallback( 144 VCMEncodedFrameCallback::VCMEncodedFrameCallback(
146 EncodedImageCallback* post_encode_callback) 145 EncodedImageCallback* post_encode_callback)
147 : send_callback_(), 146 : media_opt_(nullptr),
148 media_opt_(nullptr),
149 internal_source_(false), 147 internal_source_(false),
150 post_encode_callback_(post_encode_callback) {} 148 post_encode_callback_(post_encode_callback) {}
151 149
152 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {} 150 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {}
153 151
154 int32_t VCMEncodedFrameCallback::SetTransportCallback(
155 VCMPacketizationCallback* transport) {
156 send_callback_ = transport;
157 return VCM_OK;
158 }
159
160 int32_t VCMEncodedFrameCallback::Encoded( 152 int32_t VCMEncodedFrameCallback::Encoded(
161 const EncodedImage& encoded_image, 153 const EncodedImage& encoded_image,
162 const CodecSpecificInfo* codec_specific, 154 const CodecSpecificInfo* codec_specific,
163 const RTPFragmentationHeader* fragmentation_header) { 155 const RTPFragmentationHeader* fragmentation_header) {
164 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded", 156 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
165 "timestamp", encoded_image._timeStamp); 157 "timestamp", encoded_image._timeStamp);
166 int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific, 158 int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific,
167 fragmentation_header); 159 fragmentation_header);
168 if (ret_val < 0) 160 if (ret_val < 0)
169 return ret_val; 161 return ret_val;
170 162
171 if (media_opt_) { 163 if (media_opt_) {
172 media_opt_->UpdateWithEncodedData(encoded_image); 164 media_opt_->UpdateWithEncodedData(encoded_image);
173 if (internal_source_) 165 if (internal_source_)
174 return media_opt_->DropFrame(); // Signal to encoder to drop next frame. 166 return media_opt_->DropFrame(); // Signal to encoder to drop next frame.
175 } 167 }
176 return VCM_OK; 168 return VCM_OK;
177 } 169 }
178 170
179 void VCMEncodedFrameCallback::SetMediaOpt( 171 void VCMEncodedFrameCallback::SetMediaOpt(
180 media_optimization::MediaOptimization* mediaOpt) { 172 media_optimization::MediaOptimization* mediaOpt) {
181 media_opt_ = mediaOpt; 173 media_opt_ = mediaOpt;
182 } 174 }
183 175
184 void VCMEncodedFrameCallback::SignalLastEncoderImplementationUsed(
185 const char* implementation_name) {
186 if (send_callback_)
187 send_callback_->OnEncoderImplementationName(implementation_name);
188 }
189 } // namespace webrtc 176 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698