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

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
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 0cfbfaaee3f657974a7ecbb8ea9dbcd367ee821b..05d5bf531777b550668b616545c3caba09f1b821 100644
--- a/media/gpu/video_encode_accelerator_unittest.cc
+++ b/media/gpu/video_encode_accelerator_unittest.cc
@@ -11,6 +11,7 @@
#include <queue>
#include <string>
#include <utility>
+#include <queue>
#include "base/at_exit.h"
#include "base/bind.h"
@@ -808,7 +809,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:
@@ -989,6 +991,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,
@@ -1250,7 +1255,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_);
@@ -1262,6 +1268,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());
@@ -1400,6 +1410,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;

Powered by Google App Engine
This is Rietveld 408576698