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

Unified Diff: webrtc/modules/video_coding/generic_encoder_unittest.cc

Issue 2996153002: Reland of Add a flags field to video timing extension. (Closed)
Patch Set: Added test Created 3 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/generic_encoder_unittest.cc
diff --git a/webrtc/modules/video_coding/generic_encoder_unittest.cc b/webrtc/modules/video_coding/generic_encoder_unittest.cc
index eec5b98bbabbc9b362056726ca3f35fbb111c77d..2a5aeff85d3e3972d8bf3f7068eaa3c8dd10399f 100644
--- a/webrtc/modules/video_coding/generic_encoder_unittest.cc
+++ b/webrtc/modules/video_coding/generic_encoder_unittest.cc
@@ -31,7 +31,8 @@ class FakeEncodedImageCallback : public EncodedImageCallback {
Result OnEncodedImage(const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) override {
- last_frame_was_timing_ = encoded_image.timing_.is_timing_frame;
+ last_frame_was_timing_ =
+ encoded_image.timing_.flags != TimingFrameFlags::kInvalid;
return Result(Result::OK);
};
@@ -164,5 +165,30 @@ TEST(TestVCMEncodedFrameCallback, MarksOutliers) {
}
}
+TEST(TestVCMEncodedFrameCallback, NoTimingFrameIfNoEncodeStartTime) {
+ EncodedImage image;
+ CodecSpecificInfo codec_specific;
+ int64_t timestamp = 1;
+ image._length = 500;
+ image.capture_time_ms_ = timestamp;
+ codec_specific.codecType = kVideoCodecGeneric;
+ codec_specific.codecSpecific.generic.simulcast_idx = 0;
+ FakeEncodedImageCallback sink;
+ VCMEncodedFrameCallback callback(&sink, nullptr);
+ VideoCodec::TimingFrameTriggerThresholds thresholds;
+ thresholds.delay_ms = 1; // Make all frames timing frames.
+ callback.SetTimingFramesThresholds(thresholds);
+
+ // Verify a single frame works with encode start time set.
+ callback.OnEncodeStarted(timestamp, 0);
+ callback.OnEncodedImage(image, &codec_specific, nullptr);
+ EXPECT_TRUE(sink.WasTimingFrame());
+
+ // New frame, now skip OnEncodeStarted. Should not result in timing frame.
+ image.capture_time_ms_ = ++timestamp;
+ callback.OnEncodedImage(image, &codec_specific, nullptr);
+ EXPECT_FALSE(sink.WasTimingFrame());
+}
+
} // namespace test
} // namespace webrtc
« no previous file with comments | « webrtc/modules/video_coding/generic_encoder.cc ('k') | webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698