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

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: Rebased and fixed SendStatisics const uint. Created 4 years, 7 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 131
133 void VCMGenericEncoder::OnDroppedFrame() { 132 void VCMGenericEncoder::OnDroppedFrame() {
134 encoder_->OnDroppedFrame(); 133 encoder_->OnDroppedFrame();
135 } 134 }
136 135
137 bool VCMGenericEncoder::SupportsNativeHandle() const { 136 bool VCMGenericEncoder::SupportsNativeHandle() const {
138 return encoder_->SupportsNativeHandle(); 137 return encoder_->SupportsNativeHandle();
139 } 138 }
140 139
141 VCMEncodedFrameCallback::VCMEncodedFrameCallback( 140 VCMEncodedFrameCallback::VCMEncodedFrameCallback(
142 EncodedImageCallback* post_encode_callback) 141 EncodedImageCallback* post_encode_callback,
143 : send_callback_(), 142 media_optimization::MediaOptimization* media_opt)
144 media_opt_(nullptr), 143 : internal_source_(false),
145 internal_source_(false), 144 post_encode_callback_(post_encode_callback),
146 post_encode_callback_(post_encode_callback) {} 145 media_opt_(media_opt) {}
147 146
148 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {} 147 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {}
149 148
150 int32_t VCMEncodedFrameCallback::SetTransportCallback(
151 VCMPacketizationCallback* transport) {
152 send_callback_ = transport;
153 return VCM_OK;
154 }
155
156 int32_t VCMEncodedFrameCallback::Encoded( 149 int32_t VCMEncodedFrameCallback::Encoded(
157 const EncodedImage& encoded_image, 150 const EncodedImage& encoded_image,
158 const CodecSpecificInfo* codec_specific, 151 const CodecSpecificInfo* codec_specific,
159 const RTPFragmentationHeader* fragmentation_header) { 152 const RTPFragmentationHeader* fragmentation_header) {
160 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded", 153 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
161 "timestamp", encoded_image._timeStamp); 154 "timestamp", encoded_image._timeStamp);
162 int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific, 155 int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific,
163 fragmentation_header); 156 fragmentation_header);
164 if (ret_val < 0) 157 if (ret_val < 0)
165 return ret_val; 158 return ret_val;
166 159
167 if (media_opt_) { 160 if (media_opt_) {
168 media_opt_->UpdateWithEncodedData(encoded_image); 161 media_opt_->UpdateWithEncodedData(encoded_image);
169 if (internal_source_) 162 if (internal_source_)
170 return media_opt_->DropFrame(); // Signal to encoder to drop next frame. 163 return media_opt_->DropFrame(); // Signal to encoder to drop next frame.
171 } 164 }
172 return VCM_OK; 165 return VCM_OK;
173 } 166 }
174 167
175 void VCMEncodedFrameCallback::SetMediaOpt(
176 media_optimization::MediaOptimization* mediaOpt) {
177 media_opt_ = mediaOpt;
178 }
179
180 void VCMEncodedFrameCallback::SignalLastEncoderImplementationUsed(
181 const char* implementation_name) {
182 if (send_callback_)
183 send_callback_->OnEncoderImplementationName(implementation_name);
184 }
185 } // namespace webrtc 168 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/generic_encoder.h ('k') | webrtc/modules/video_coding/include/video_coding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698