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 |
11 #include "webrtc/modules/video_coding/generic_encoder.h" | 11 #include "webrtc/modules/video_coding/generic_encoder.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
17 #include "webrtc/base/trace_event.h" | 17 #include "webrtc/base/trace_event.h" |
18 #include "webrtc/engine_configurations.h" | 18 #include "webrtc/engine_configurations.h" |
19 #include "webrtc/modules/video_coding/encoded_frame.h" | 19 #include "webrtc/modules/video_coding/encoded_frame.h" |
20 #include "webrtc/modules/video_coding/media_optimization.h" | 20 #include "webrtc/modules/video_coding/media_optimization.h" |
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
| 24 |
24 VCMGenericEncoder::VCMGenericEncoder( | 25 VCMGenericEncoder::VCMGenericEncoder( |
25 VideoEncoder* encoder, | 26 VideoEncoder* encoder, |
26 VCMEncodedFrameCallback* encoded_frame_callback, | 27 VCMEncodedFrameCallback* encoded_frame_callback, |
27 bool internal_source) | 28 bool internal_source) |
28 : encoder_(encoder), | 29 : encoder_(encoder), |
29 vcm_encoded_frame_callback_(encoded_frame_callback), | 30 vcm_encoded_frame_callback_(encoded_frame_callback), |
30 internal_source_(internal_source), | 31 internal_source_(internal_source), |
31 encoder_params_({0, 0, 0, 0}), | 32 encoder_params_({0, 0, 0, 0}), |
32 is_screenshare_(false) {} | 33 is_screenshare_(false) {} |
33 | 34 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 137 |
137 VCMEncodedFrameCallback::VCMEncodedFrameCallback( | 138 VCMEncodedFrameCallback::VCMEncodedFrameCallback( |
138 EncodedImageCallback* post_encode_callback, | 139 EncodedImageCallback* post_encode_callback, |
139 media_optimization::MediaOptimization* media_opt) | 140 media_optimization::MediaOptimization* media_opt) |
140 : internal_source_(false), | 141 : internal_source_(false), |
141 post_encode_callback_(post_encode_callback), | 142 post_encode_callback_(post_encode_callback), |
142 media_opt_(media_opt) {} | 143 media_opt_(media_opt) {} |
143 | 144 |
144 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {} | 145 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {} |
145 | 146 |
146 int32_t VCMEncodedFrameCallback::Encoded( | 147 EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage( |
147 const EncodedImage& encoded_image, | 148 const EncodedImage& encoded_image, |
148 const CodecSpecificInfo* codec_specific, | 149 const CodecSpecificInfo* codec_specific, |
149 const RTPFragmentationHeader* fragmentation_header) { | 150 const RTPFragmentationHeader* fragmentation_header) { |
150 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded", | 151 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded", |
151 "timestamp", encoded_image._timeStamp); | 152 "timestamp", encoded_image._timeStamp); |
152 int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific, | 153 Result result = post_encode_callback_->OnEncodedImage( |
153 fragmentation_header); | 154 encoded_image, codec_specific, fragmentation_header); |
154 if (ret_val < 0) | 155 if (result.error != Result::OK) |
155 return ret_val; | 156 return result; |
156 | 157 |
157 if (media_opt_) { | 158 if (media_opt_) { |
158 media_opt_->UpdateWithEncodedData(encoded_image); | 159 media_opt_->UpdateWithEncodedData(encoded_image); |
159 if (internal_source_) | 160 if (internal_source_) { |
160 return media_opt_->DropFrame(); // Signal to encoder to drop next frame. | 161 // Signal to encoder to drop next frame. |
| 162 result.drop_next_frame = media_opt_->DropFrame(); |
| 163 } |
161 } | 164 } |
162 return VCM_OK; | 165 return result; |
163 } | 166 } |
164 | 167 |
165 } // namespace webrtc | 168 } // namespace webrtc |
OLD | NEW |