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

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

Issue 2203233002: Revert of Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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
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
25 VCMGenericEncoder::VCMGenericEncoder( 24 VCMGenericEncoder::VCMGenericEncoder(
26 VideoEncoder* encoder, 25 VideoEncoder* encoder,
27 VCMEncodedFrameCallback* encoded_frame_callback, 26 VCMEncodedFrameCallback* encoded_frame_callback,
28 bool internal_source) 27 bool internal_source)
29 : encoder_(encoder), 28 : encoder_(encoder),
30 vcm_encoded_frame_callback_(encoded_frame_callback), 29 vcm_encoded_frame_callback_(encoded_frame_callback),
31 internal_source_(internal_source), 30 internal_source_(internal_source),
32 encoder_params_({0, 0, 0, 0}), 31 encoder_params_({0, 0, 0, 0}),
33 is_screenshare_(false) {} 32 is_screenshare_(false) {}
34 33
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 VCMEncodedFrameCallback::VCMEncodedFrameCallback( 137 VCMEncodedFrameCallback::VCMEncodedFrameCallback(
139 EncodedImageCallback* post_encode_callback, 138 EncodedImageCallback* post_encode_callback,
140 media_optimization::MediaOptimization* media_opt) 139 media_optimization::MediaOptimization* media_opt)
141 : internal_source_(false), 140 : internal_source_(false),
142 post_encode_callback_(post_encode_callback), 141 post_encode_callback_(post_encode_callback),
143 media_opt_(media_opt) {} 142 media_opt_(media_opt) {}
144 143
145 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {} 144 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {}
146 145
147 EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage( 146 int32_t VCMEncodedFrameCallback::Encoded(
148 const EncodedImage& encoded_image, 147 const EncodedImage& encoded_image,
149 const CodecSpecificInfo* codec_specific, 148 const CodecSpecificInfo* codec_specific,
150 const RTPFragmentationHeader* fragmentation_header) { 149 const RTPFragmentationHeader* fragmentation_header) {
151 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded", 150 TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
152 "timestamp", encoded_image._timeStamp); 151 "timestamp", encoded_image._timeStamp);
153 Result result = post_encode_callback_->OnEncodedImage( 152 int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific,
154 encoded_image, codec_specific, fragmentation_header); 153 fragmentation_header);
155 if (result.error != Result::OK) 154 if (ret_val < 0)
156 return result; 155 return ret_val;
157 156
158 if (media_opt_) { 157 if (media_opt_) {
159 media_opt_->UpdateWithEncodedData(encoded_image); 158 media_opt_->UpdateWithEncodedData(encoded_image);
160 if (internal_source_) { 159 if (internal_source_)
161 // Signal to encoder to drop next frame. 160 return media_opt_->DropFrame(); // Signal to encoder to drop next frame.
162 result.drop_next_frame = media_opt_->DropFrame();
163 }
164 } 161 }
165 return result; 162 return VCM_OK;
166 } 163 }
167 164
168 } // namespace webrtc 165 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/generic_encoder.h ('k') | webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698