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; |