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

Unified Diff: media/gpu/video_encode_accelerator_unittest.cc

Issue 1996453003: RTC Video Encoder: Use capturer timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/gpu/vaapi_video_encode_accelerator.cc ('k') | media/gpu/vt_video_encode_accelerator_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/video_encode_accelerator_unittest.cc
diff --git a/media/gpu/video_encode_accelerator_unittest.cc b/media/gpu/video_encode_accelerator_unittest.cc
index 739506756d8af4808b215cd13d093dc104ab02ca..5b77463b2027e0524a67429997e9dd49b6a7419f 100644
--- a/media/gpu/video_encode_accelerator_unittest.cc
+++ b/media/gpu/video_encode_accelerator_unittest.cc
@@ -774,7 +774,8 @@ class VEAClient : public VideoEncodeAccelerator::Client {
size_t output_buffer_size) override;
void BitstreamBufferReady(int32_t bitstream_buffer_id,
size_t payload_size,
- bool key_frame) override;
+ bool key_frame,
+ base::TimeDelta timestamp) override;
void NotifyError(VideoEncodeAccelerator::Error error) override;
private:
@@ -955,6 +956,9 @@ class VEAClient : public VideoEncodeAccelerator::Client {
// The timer used to feed the encoder with the input frames.
std::unique_ptr<base::RepeatingTimer> input_timer_;
+
+ // The timestamps for each frame in the order of CreateFrame() invocation.
+ std::queue<base::TimeDelta> frame_timestamps_;
};
VEAClient::VEAClient(TestStream* test_stream,
@@ -1216,7 +1220,8 @@ void VEAClient::RequireBitstreamBuffers(unsigned int input_count,
void VEAClient::BitstreamBufferReady(int32_t bitstream_buffer_id,
size_t payload_size,
- bool key_frame) {
+ bool key_frame,
+ base::TimeDelta timestamp) {
DCHECK(thread_checker_.CalledOnValidThread());
ASSERT_LE(payload_size, output_buffer_size_);
@@ -1228,6 +1233,10 @@ void VEAClient::BitstreamBufferReady(int32_t bitstream_buffer_id,
if (state_ == CS_FINISHED || state_ == CS_VALIDATED)
return;
+ ASSERT_FALSE(frame_timestamps_.empty());
+ ASSERT_EQ(timestamp, frame_timestamps_.front());
+ frame_timestamps_.pop();
+
encoded_stream_size_since_last_check_ += payload_size;
const uint8_t* stream_ptr = static_cast<const uint8_t*>(shm->memory());
@@ -1367,6 +1376,7 @@ void VEAClient::FeedEncoderWithOneInput() {
int32_t input_id;
scoped_refptr<media::VideoFrame> video_frame =
PrepareInputFrame(pos_in_input_stream_, &input_id);
+ frame_timestamps_.push(video_frame->timestamp());
pos_in_input_stream_ += test_stream_->aligned_buffer_size;
bool force_keyframe = false;
« no previous file with comments | « media/gpu/vaapi_video_encode_accelerator.cc ('k') | media/gpu/vt_video_encode_accelerator_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698