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

Side by Side Diff: webrtc/video/vie_encoder_unittest.cc

Issue 2772033002: Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Set EncodedImage content_type from vie_encoder Created 3 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 }; 63 };
64 64
65 class ViEEncoderUnderTest : public ViEEncoder { 65 class ViEEncoderUnderTest : public ViEEncoder {
66 public: 66 public:
67 ViEEncoderUnderTest(SendStatisticsProxy* stats_proxy, 67 ViEEncoderUnderTest(SendStatisticsProxy* stats_proxy,
68 const VideoSendStream::Config::EncoderSettings& settings) 68 const VideoSendStream::Config::EncoderSettings& settings)
69 : ViEEncoder(1 /* number_of_cores */, 69 : ViEEncoder(1 /* number_of_cores */,
70 stats_proxy, 70 stats_proxy,
71 settings, 71 settings,
72 nullptr /* pre_encode_callback */, 72 nullptr /* pre_encode_callback */,
73 nullptr /* encoder_timing */) {} 73 nullptr /* encoder_timing */,
74 VideoEncoderConfig::ContentType::kRealtimeVideo) {}
74 75
75 void PostTaskAndWait(bool down, AdaptReason reason) { 76 void PostTaskAndWait(bool down, AdaptReason reason) {
76 rtc::Event event(false, false); 77 rtc::Event event(false, false);
77 encoder_queue()->PostTask([this, &event, reason, down] { 78 encoder_queue()->PostTask([this, &event, reason, down] {
78 down ? AdaptDown(reason) : AdaptUp(reason); 79 down ? AdaptDown(reason) : AdaptUp(reason);
79 event.Set(); 80 event.Set();
80 }); 81 });
81 ASSERT_TRUE(event.Wait(5000)); 82 ASSERT_TRUE(event.Wait(5000));
82 } 83 }
83 84
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 int cropped_height = 0; 144 int cropped_height = 0;
144 int out_width = 0; 145 int out_width = 0;
145 int out_height = 0; 146 int out_height = 0;
146 if (adaption_enabled() && 147 if (adaption_enabled() &&
147 adapter_.AdaptFrameResolution(video_frame.width(), video_frame.height(), 148 adapter_.AdaptFrameResolution(video_frame.width(), video_frame.height(),
148 video_frame.timestamp_us() * 1000, 149 video_frame.timestamp_us() * 1000,
149 &cropped_width, &cropped_height, 150 &cropped_width, &cropped_height,
150 &out_width, &out_height)) { 151 &out_width, &out_height)) {
151 VideoFrame adapted_frame( 152 VideoFrame adapted_frame(
152 new rtc::RefCountedObject<TestBuffer>(nullptr, out_width, out_height), 153 new rtc::RefCountedObject<TestBuffer>(nullptr, out_width, out_height),
153 99, 99, kVideoRotation_0); 154 99, 99, kVideoRotation_0, webrtc::kVideoContent_Default);
154 adapted_frame.set_ntp_time_ms(video_frame.ntp_time_ms()); 155 adapted_frame.set_ntp_time_ms(video_frame.ntp_time_ms());
155 test::FrameForwarder::IncomingCapturedFrame(adapted_frame); 156 test::FrameForwarder::IncomingCapturedFrame(adapted_frame);
156 } else { 157 } else {
157 test::FrameForwarder::IncomingCapturedFrame(video_frame); 158 test::FrameForwarder::IncomingCapturedFrame(video_frame);
158 } 159 }
159 } 160 }
160 161
161 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, 162 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
162 const rtc::VideoSinkWants& wants) override { 163 const rtc::VideoSinkWants& wants) override {
163 rtc::CritScope cs(&crit_); 164 rtc::CritScope cs(&crit_);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 video_encoder_config.max_bitrate_bps = kTargetBitrateBps; 226 video_encoder_config.max_bitrate_bps = kTargetBitrateBps;
226 video_encoder_config.video_stream_factory = 227 video_encoder_config.video_stream_factory =
227 new rtc::RefCountedObject<VideoStreamFactory>(num_temporal_layers); 228 new rtc::RefCountedObject<VideoStreamFactory>(num_temporal_layers);
228 ConfigureEncoder(std::move(video_encoder_config), nack_enabled); 229 ConfigureEncoder(std::move(video_encoder_config), nack_enabled);
229 } 230 }
230 231
231 VideoFrame CreateFrame(int64_t ntp_time_ms, 232 VideoFrame CreateFrame(int64_t ntp_time_ms,
232 rtc::Event* destruction_event) const { 233 rtc::Event* destruction_event) const {
233 VideoFrame frame(new rtc::RefCountedObject<TestBuffer>( 234 VideoFrame frame(new rtc::RefCountedObject<TestBuffer>(
234 destruction_event, codec_width_, codec_height_), 235 destruction_event, codec_width_, codec_height_),
235 99, 99, kVideoRotation_0); 236 99, 99, kVideoRotation_0, webrtc::kVideoContent_Default);
236 frame.set_ntp_time_ms(ntp_time_ms); 237 frame.set_ntp_time_ms(ntp_time_ms);
237 return frame; 238 return frame;
238 } 239 }
239 240
240 VideoFrame CreateFrame(int64_t ntp_time_ms, int width, int height) const { 241 VideoFrame CreateFrame(int64_t ntp_time_ms, int width, int height) const {
241 VideoFrame frame( 242 VideoFrame frame(
242 new rtc::RefCountedObject<TestBuffer>(nullptr, width, height), 99, 99, 243 new rtc::RefCountedObject<TestBuffer>(nullptr, width, height), 99, 99,
243 kVideoRotation_0); 244 kVideoRotation_0, webrtc::kVideoContent_Default);
244 frame.set_ntp_time_ms(ntp_time_ms); 245 frame.set_ntp_time_ms(ntp_time_ms);
245 return frame; 246 return frame;
246 } 247 }
247 248
248 class TestEncoder : public test::FakeEncoder { 249 class TestEncoder : public test::FakeEncoder {
249 public: 250 public:
250 TestEncoder() 251 TestEncoder()
251 : FakeEncoder(Clock::GetRealTimeClock()), 252 : FakeEncoder(Clock::GetRealTimeClock()),
252 continue_encode_event_(false, false) {} 253 continue_encode_event_(false, false) {}
253 254
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 1238
1238 // Trigger CPU normal use, return to original resoluton; 1239 // Trigger CPU normal use, return to original resoluton;
1239 vie_encoder_->TriggerCpuNormalUsage(); 1240 vie_encoder_->TriggerCpuNormalUsage();
1240 video_source_.IncomingCapturedFrame( 1241 video_source_.IncomingCapturedFrame(
1241 CreateFrame(3, kFrameWidth, kFrameHeight)); 1242 CreateFrame(3, kFrameWidth, kFrameHeight));
1242 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight); 1243 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight);
1243 1244
1244 vie_encoder_->Stop(); 1245 vie_encoder_->Stop();
1245 } 1246 }
1246 } // namespace webrtc 1247 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698