diff --git a/api/video/encoded_frame.cc b/api/video/encoded_frame.cc index f9152b23f1..26a794ec02 100644 --- a/api/video/encoded_frame.cc +++ b/api/video/encoded_frame.cc @@ -17,13 +17,5 @@ bool EncodedFrame::delayed_by_retransmission() const { return 0; } -uint32_t EncodedFrame::Timestamp() const { - return timestamp; -} - -void EncodedFrame::SetTimestamp(uint32_t rtp_timestamp) { - timestamp = rtp_timestamp; -} - } // namespace video_coding } // namespace webrtc diff --git a/api/video/encoded_frame.h b/api/video/encoded_frame.h index 1b0a26a5fc..b8462c6c2c 100644 --- a/api/video/encoded_frame.h +++ b/api/video/encoded_frame.h @@ -58,10 +58,6 @@ class EncodedFrame : public webrtc::VCMEncodedFrame { virtual bool GetBitstream(uint8_t* destination) const = 0; - // The capture timestamp of this frame, using the 90 kHz RTP clock. - virtual uint32_t Timestamp() const; - virtual void SetTimestamp(uint32_t rtp_timestamp); - // When this frame was received. virtual int64_t ReceivedTime() const = 0; @@ -78,7 +74,6 @@ class EncodedFrame : public webrtc::VCMEncodedFrame { bool is_keyframe() const { return num_references == 0; } VideoLayerFrameId id; - uint32_t timestamp = 0; // TODO(philipel): Add simple modify/access functions to prevent adding too // many |references|. diff --git a/common_video/include/video_frame.h b/common_video/include/video_frame.h index 41c391941e..7b85cc8fe1 100644 --- a/common_video/include/video_frame.h +++ b/common_video/include/video_frame.h @@ -37,6 +37,14 @@ class EncodedImage { EncodedImage(const EncodedImage&); EncodedImage(uint8_t* buffer, size_t length, size_t size); + // TODO(nisse): Change style to timestamp(), set_timestamp(), for consistency + // with the VideoFrame class. + // Set frame timestamp (90kHz). + void SetTimestamp(uint32_t timestamp) { _timeStamp = timestamp; } + + // Get frame timestamp (90kHz). + uint32_t Timestamp() const { return _timeStamp; } + void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms); uint32_t _encodedWidth = 0; diff --git a/modules/video_coding/decoding_state.cc b/modules/video_coding/decoding_state.cc index 23bf668747..1d540637ca 100644 --- a/modules/video_coding/decoding_state.cc +++ b/modules/video_coding/decoding_state.cc @@ -58,7 +58,7 @@ bool VCMDecodingState::IsOldFrame(const VCMFrameBuffer* frame) const { assert(frame != NULL); if (in_initial_state_) return false; - return !IsNewerTimestamp(frame->TimeStamp(), time_stamp_); + return !IsNewerTimestamp(frame->Timestamp(), time_stamp_); } bool VCMDecodingState::IsOldPacket(const VCMPacket* packet) const { @@ -73,7 +73,7 @@ void VCMDecodingState::SetState(const VCMFrameBuffer* frame) { if (!UsingFlexibleMode(frame)) UpdateSyncState(frame); sequence_num_ = static_cast(frame->GetHighSeqNum()); - time_stamp_ = frame->TimeStamp(); + time_stamp_ = frame->Timestamp(); picture_id_ = frame->PictureId(); temporal_id_ = frame->TemporalId(); tl0_pic_id_ = frame->Tl0PicId(); @@ -143,7 +143,7 @@ bool VCMDecodingState::UpdateEmptyFrame(const VCMFrameBuffer* frame) { // Continuous empty packets or continuous frames can be dropped if we // advance the sequence number. sequence_num_ = frame->GetHighSeqNum(); - time_stamp_ = frame->TimeStamp(); + time_stamp_ = frame->Timestamp(); return true; } return false; diff --git a/modules/video_coding/encoded_frame.h b/modules/video_coding/encoded_frame.h index 17c61d7544..aadfcdf52e 100644 --- a/modules/video_coding/encoded_frame.h +++ b/modules/video_coding/encoded_frame.h @@ -65,10 +65,12 @@ class VCMEncodedFrame : protected EncodedImage { * Get frame length */ size_t Length() const { return _length; } + /** - * Get frame timestamp (90kHz) + * Frame RTP timestamp (90kHz) */ - uint32_t TimeStamp() const { return _timeStamp; } + using EncodedImage::Timestamp; + using EncodedImage::SetTimestamp; /** * Get render time in milliseconds */ diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc index f13ed35aef..8bb241a925 100644 --- a/modules/video_coding/frame_buffer2.cc +++ b/modules/video_coding/frame_buffer2.cc @@ -117,7 +117,8 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame( next_frame_it_ = frame_it; if (frame->RenderTime() == -1) - frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); + frame->SetRenderTime( + timing_->RenderTimeMs(frame->Timestamp(), now_ms)); wait_ms = timing_->MaxWaitingTime(frame->RenderTime(), now_ms); // This will cause the frame buffer to prefer high framerate rather @@ -146,7 +147,7 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame( if (!frame->delayed_by_retransmission()) { int64_t frame_delay; - if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay, + if (inter_frame_delay_.CalculateDelay(frame->Timestamp(), &frame_delay, frame->ReceivedTime())) { jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); } @@ -163,7 +164,7 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame( if (HasBadRenderTiming(*frame, now_ms)) { jitter_estimator_->Reset(); timing_->Reset(); - frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); + frame->SetRenderTime(timing_->RenderTimeMs(frame->Timestamp(), now_ms)); } UpdateJitterDelay(); @@ -177,17 +178,17 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame( const VideoLayerFrameId& frame_key = next_frame_it_->first; const bool frame_is_higher_spatial_layer_of_last_decoded_frame = - last_decoded_frame_timestamp_ == frame->timestamp && + last_decoded_frame_timestamp_ == frame->Timestamp() && last_decoded_frame_key.picture_id == frame_key.picture_id && last_decoded_frame_key.spatial_layer < frame_key.spatial_layer; - if (AheadOrAt(last_decoded_frame_timestamp_, frame->timestamp) && + if (AheadOrAt(last_decoded_frame_timestamp_, frame->Timestamp()) && !frame_is_higher_spatial_layer_of_last_decoded_frame) { // TODO(brandtr): Consider clearing the entire buffer when we hit // these conditions. RTC_LOG(LS_WARNING) << "Frame with (timestamp:picture_id:spatial_id) (" - << frame->timestamp << ":" << frame->id.picture_id << ":" + << frame->Timestamp() << ":" << frame->id.picture_id << ":" << static_cast(frame->id.spatial_layer) << ")" << " sent to decoder after frame with" << " (timestamp:picture_id:spatial_id) (" @@ -198,7 +199,7 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame( } AdvanceLastDecodedFrame(next_frame_it_); - last_decoded_frame_timestamp_ = frame->timestamp; + last_decoded_frame_timestamp_ = frame->Timestamp(); *frame_out = std::move(frame); return kFrameFound; } @@ -297,7 +298,7 @@ void FrameBuffer::UpdatePlayoutDelays(const EncodedFrame& frame) { timing_->set_max_playout_delay(playout_delay.max_ms); if (!frame.delayed_by_retransmission()) - timing_->IncomingTimestamp(frame.timestamp, frame.ReceivedTime()); + timing_->IncomingTimestamp(frame.Timestamp(), frame.ReceivedTime()); } int64_t FrameBuffer::InsertFrame(std::unique_ptr frame) { @@ -343,7 +344,7 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr frame) { if (last_decoded_frame_it_ != frames_.end() && id <= last_decoded_frame_it_->first) { - if (AheadOf(frame->timestamp, last_decoded_frame_timestamp_) && + if (AheadOf(frame->Timestamp(), last_decoded_frame_timestamp_) && frame->is_keyframe()) { // If this frame has a newer timestamp but an earlier picture id then we // assume there has been a jump in the picture id due to some encoder diff --git a/modules/video_coding/frame_buffer2_unittest.cc b/modules/video_coding/frame_buffer2_unittest.cc index 1378be5a84..357ba86540 100644 --- a/modules/video_coding/frame_buffer2_unittest.cc +++ b/modules/video_coding/frame_buffer2_unittest.cc @@ -90,8 +90,6 @@ class FrameObjectFake : public EncodedFrame { public: bool GetBitstream(uint8_t* destination) const override { return true; } - uint32_t Timestamp() const override { return timestamp; } - int64_t ReceivedTime() const override { return 0; } int64_t RenderTime() const override { return _renderTimeMs; } @@ -165,7 +163,7 @@ class TestFrameBuffer2 : public ::testing::Test { std::unique_ptr frame(new FrameObjectFake()); frame->id.picture_id = picture_id; frame->id.spatial_layer = spatial_layer; - frame->timestamp = ts_ms * 90; + frame->SetTimestamp(ts_ms * 90); frame->num_references = references.size(); frame->inter_layer_predicted = inter_layer_predicted; for (size_t r = 0; r < references.size(); ++r) @@ -520,7 +518,7 @@ TEST_F(TestFrameBuffer2, StatsCallback) { frame->SetSize(kFrameSize); frame->id.picture_id = pid; frame->id.spatial_layer = 0; - frame->timestamp = ts; + frame->SetTimestamp(ts); frame->num_references = 0; frame->inter_layer_predicted = false; diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc index a3fc0d12cb..20e7565542 100644 --- a/modules/video_coding/frame_object.cc +++ b/modules/video_coding/frame_object.cc @@ -26,7 +26,6 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer, : packet_buffer_(packet_buffer), first_seq_num_(first_seq_num), last_seq_num_(last_seq_num), - timestamp_(0), received_time_(received_time), times_nacked_(times_nacked) { VCMPacket* first_packet = packet_buffer_->GetPacket(first_seq_num); @@ -69,7 +68,7 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer, _encodedHeight = first_packet->height; // EncodedFrame members - timestamp = first_packet->timestamp; + SetTimestamp(first_packet->timestamp); VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num); RTC_CHECK(last_packet); @@ -140,10 +139,6 @@ bool RtpFrameObject::GetBitstream(uint8_t* destination) const { return packet_buffer_->GetBitstream(*this, destination); } -uint32_t RtpFrameObject::Timestamp() const { - return timestamp_; -} - int64_t RtpFrameObject::ReceivedTime() const { return received_time_; } diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h index 898098451d..6c6480a867 100644 --- a/modules/video_coding/frame_object.h +++ b/modules/video_coding/frame_object.h @@ -37,7 +37,6 @@ class RtpFrameObject : public EncodedFrame { enum FrameType frame_type() const; VideoCodecType codec_type() const; bool GetBitstream(uint8_t* destination) const override; - uint32_t Timestamp() const override; int64_t ReceivedTime() const override; int64_t RenderTime() const override; bool delayed_by_retransmission() const override; @@ -49,7 +48,6 @@ class RtpFrameObject : public EncodedFrame { VideoCodecType codec_type_; uint16_t first_seq_num_; uint16_t last_seq_num_; - uint32_t timestamp_; int64_t received_time_; // Equal to times nacked of the packet with the highet times nacked diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc index 01500e7f89..44610ad36d 100644 --- a/modules/video_coding/generic_decoder.cc +++ b/modules/video_coding/generic_decoder.cc @@ -225,7 +225,7 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) { } else { _frameInfos[_nextFrameInfoIdx].content_type = _last_keyframe_content_type; } - _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]); + _callback->Map(frame.Timestamp(), &_frameInfos[_nextFrameInfoIdx]); _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength; int32_t ret = decoder_->Decode(frame.EncodedImage(), frame.MissingFrame(), @@ -234,13 +234,13 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) { _callback->OnDecoderImplementationName(decoder_->ImplementationName()); if (ret < WEBRTC_VIDEO_CODEC_OK) { RTC_LOG(LS_WARNING) << "Failed to decode frame with timestamp " - << frame.TimeStamp() << ", error code: " << ret; - _callback->Pop(frame.TimeStamp()); + << frame.Timestamp() << ", error code: " << ret; + _callback->Pop(frame.Timestamp()); return ret; } else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT || ret == WEBRTC_VIDEO_CODEC_REQUEST_SLI) { // No output - _callback->Pop(frame.TimeStamp()); + _callback->Pop(frame.Timestamp()); } return ret; } diff --git a/modules/video_coding/jitter_buffer.cc b/modules/video_coding/jitter_buffer.cc index 5f45ece595..0699e3bf16 100644 --- a/modules/video_coding/jitter_buffer.cc +++ b/modules/video_coding/jitter_buffer.cc @@ -54,7 +54,7 @@ bool HasNonEmptyState(FrameListPair pair) { } void FrameList::InsertFrame(VCMFrameBuffer* frame) { - insert(rbegin().base(), FrameListPair(frame->TimeStamp(), frame)); + insert(rbegin().base(), FrameListPair(frame->Timestamp(), frame)); } VCMFrameBuffer* FrameList::PopFrame(uint32_t timestamp) { @@ -110,7 +110,7 @@ void FrameList::CleanUpOldOrEmptyFrames(VCMDecodingState* decoding_state, } free_frames->push_back(oldest_frame); TRACE_EVENT_INSTANT1("webrtc", "JB::OldOrEmptyFrameDropped", "timestamp", - oldest_frame->TimeStamp()); + oldest_frame->Timestamp()); erase(begin()); } } @@ -206,7 +206,7 @@ void Vp9SsMap::UpdateFrames(FrameList* frames) { continue; } SsMap::iterator ss_it; - if (Find(frame_it.second->TimeStamp(), &ss_it)) { + if (Find(frame_it.second->Timestamp(), &ss_it)) { if (gof_idx >= ss_it->second.num_frames_in_gof) { continue; // Assume corresponding SS not yet received. } @@ -522,7 +522,7 @@ bool VCMJitterBuffer::NextMaybeIncompleteTimestamp(uint32_t* timestamp) { } } - *timestamp = oldest_frame->TimeStamp(); + *timestamp = oldest_frame->Timestamp(); return true; } @@ -558,7 +558,7 @@ VCMEncodedFrame* VCMJitterBuffer::ExtractAndSetDecode(uint32_t timestamp) { // Wait for this one to get complete. waiting_for_completion_.frame_size = frame->Length(); waiting_for_completion_.latest_packet_time = frame->LatestPacketTimeMs(); - waiting_for_completion_.timestamp = frame->TimeStamp(); + waiting_for_completion_.timestamp = frame->Timestamp(); } } @@ -709,8 +709,8 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet, frame->InsertPacket(packet, now_ms, decode_error_mode_, frame_data); if (previous_state != kStateComplete) { - TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", frame->TimeStamp(), "timestamp", - frame->TimeStamp()); + TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", frame->Timestamp(), "timestamp", + frame->Timestamp()); } if (buffer_state > 0) { @@ -825,7 +825,7 @@ bool VCMJitterBuffer::IsContinuous(const VCMFrameBuffer& frame) const { for (FrameList::const_iterator it = decodable_frames_.begin(); it != decodable_frames_.end(); ++it) { VCMFrameBuffer* decodable_frame = it->second; - if (IsNewerTimestamp(decodable_frame->TimeStamp(), frame.TimeStamp())) { + if (IsNewerTimestamp(decodable_frame->Timestamp(), frame.Timestamp())) { break; } decoding_state.SetState(decodable_frame); @@ -859,7 +859,7 @@ void VCMJitterBuffer::FindAndInsertContinuousFramesWithState( it != incomplete_frames_.end();) { VCMFrameBuffer* frame = it->second; if (IsNewerTimestamp(original_decoded_state.time_stamp(), - frame->TimeStamp())) { + frame->Timestamp())) { ++it; continue; } @@ -941,11 +941,11 @@ int VCMJitterBuffer::NonContinuousOrIncompleteDuration() { if (incomplete_frames_.empty()) { return 0; } - uint32_t start_timestamp = incomplete_frames_.Front()->TimeStamp(); + uint32_t start_timestamp = incomplete_frames_.Front()->Timestamp(); if (!decodable_frames_.empty()) { - start_timestamp = decodable_frames_.Back()->TimeStamp(); + start_timestamp = decodable_frames_.Back()->Timestamp(); } - return incomplete_frames_.Back()->TimeStamp() - start_timestamp; + return incomplete_frames_.Back()->Timestamp() - start_timestamp; } uint16_t VCMJitterBuffer::EstimatedLowSequenceNumber( @@ -1178,10 +1178,10 @@ void VCMJitterBuffer::CountFrame(const VCMFrameBuffer& frame) { incoming_frame_count_++; if (frame.FrameType() == kVideoFrameKey) { - TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.TimeStamp(), + TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.Timestamp(), "KeyComplete"); } else { - TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.TimeStamp(), + TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.Timestamp(), "DeltaComplete"); } @@ -1257,7 +1257,7 @@ void VCMJitterBuffer::UpdateJitterEstimate(const VCMFrameBuffer& frame, } // No retransmitted frames should be a part of the jitter // estimate. - UpdateJitterEstimate(frame.LatestPacketTimeMs(), frame.TimeStamp(), + UpdateJitterEstimate(frame.LatestPacketTimeMs(), frame.Timestamp(), frame.Length(), incomplete_frame); } diff --git a/modules/video_coding/jitter_buffer_unittest.cc b/modules/video_coding/jitter_buffer_unittest.cc index 71c17ea6c8..b40b8ba8a5 100644 --- a/modules/video_coding/jitter_buffer_unittest.cc +++ b/modules/video_coding/jitter_buffer_unittest.cc @@ -250,7 +250,7 @@ class TestBasicJitterBuffer : public ::testing::TestWithParam, VCMEncodedFrame* found_frame = jitter_buffer_->NextCompleteFrame(10); if (!found_frame) return nullptr; - return jitter_buffer_->ExtractAndSetDecode(found_frame->TimeStamp()); + return jitter_buffer_->ExtractAndSetDecode(found_frame->Timestamp()); } VCMEncodedFrame* DecodeIncompleteFrame() { @@ -405,7 +405,7 @@ class TestRunningJitterBuffer : public ::testing::TestWithParam, return false; VCMEncodedFrame* frame = - jitter_buffer_->ExtractAndSetDecode(found_frame->TimeStamp()); + jitter_buffer_->ExtractAndSetDecode(found_frame->Timestamp()); bool ret = (frame != NULL); jitter_buffer_->ReleaseFrame(frame); return ret; @@ -952,12 +952,12 @@ TEST_F(TestBasicJitterBuffer, TestSkipForwardVp9) { EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(1000U, frame_out->TimeStamp()); + EXPECT_EQ(1000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); jitter_buffer_->ReleaseFrame(frame_out); frame_out = DecodeCompleteFrame(); - EXPECT_EQ(13000U, frame_out->TimeStamp()); + EXPECT_EQ(13000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType()); jitter_buffer_->ReleaseFrame(frame_out); } @@ -1014,7 +1014,7 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_3TlLayers) { EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(3000U, frame_out->TimeStamp()); + EXPECT_EQ(3000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); EXPECT_EQ(0, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx); EXPECT_FALSE( @@ -1022,14 +1022,14 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_3TlLayers) { jitter_buffer_->ReleaseFrame(frame_out); frame_out = DecodeCompleteFrame(); - EXPECT_EQ(6000U, frame_out->TimeStamp()); + EXPECT_EQ(6000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType()); EXPECT_EQ(2, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx); EXPECT_TRUE(frame_out->CodecSpecific()->codecSpecific.VP9.temporal_up_switch); jitter_buffer_->ReleaseFrame(frame_out); frame_out = DecodeCompleteFrame(); - EXPECT_EQ(9000U, frame_out->TimeStamp()); + EXPECT_EQ(9000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType()); EXPECT_EQ(1, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx); EXPECT_TRUE(frame_out->CodecSpecific()->codecSpecific.VP9.temporal_up_switch); @@ -1105,7 +1105,7 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) { EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(3000U, frame_out->TimeStamp()); + EXPECT_EQ(3000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); EXPECT_EQ(0, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx); EXPECT_FALSE( @@ -1113,7 +1113,7 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) { jitter_buffer_->ReleaseFrame(frame_out); frame_out = DecodeCompleteFrame(); - EXPECT_EQ(6000U, frame_out->TimeStamp()); + EXPECT_EQ(6000U, frame_out->Timestamp()); EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType()); EXPECT_EQ(1, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx); EXPECT_TRUE(frame_out->CodecSpecific()->codecSpecific.VP9.temporal_up_switch); @@ -1461,8 +1461,8 @@ TEST_F(TestBasicJitterBuffer, DiscontinuousStreamWhenDecodingWithErrors) { uint32_t next_timestamp; VCMEncodedFrame* frame = jitter_buffer_->NextCompleteFrame(0); EXPECT_NE(frame, nullptr); - EXPECT_EQ(packet_->timestamp, frame->TimeStamp()); - frame = jitter_buffer_->ExtractAndSetDecode(frame->TimeStamp()); + EXPECT_EQ(packet_->timestamp, frame->Timestamp()); + frame = jitter_buffer_->ExtractAndSetDecode(frame->Timestamp()); EXPECT_TRUE(frame != NULL); jitter_buffer_->ReleaseFrame(frame); @@ -1708,7 +1708,7 @@ TEST_F(TestBasicJitterBuffer, TestInsertOldFrame) { jitter_buffer_->InsertPacket(*packet_, &retransmitted)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(3000u, frame_out->TimeStamp()); + EXPECT_EQ(3000u, frame_out->Timestamp()); CheckOutFrame(frame_out, size_, false); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); jitter_buffer_->ReleaseFrame(frame_out); @@ -1743,7 +1743,7 @@ TEST_F(TestBasicJitterBuffer, TestInsertOldFrameWithSeqNumWrap) { jitter_buffer_->InsertPacket(*packet_, &retransmitted)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(timestamp_, frame_out->TimeStamp()); + EXPECT_EQ(timestamp_, frame_out->Timestamp()); CheckOutFrame(frame_out, size_, false); @@ -1853,13 +1853,13 @@ TEST_F(TestBasicJitterBuffer, 2FrameWithTimestampWrap) { jitter_buffer_->InsertPacket(*packet_, &retransmitted)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(0xffffff00, frame_out->TimeStamp()); + EXPECT_EQ(0xffffff00, frame_out->Timestamp()); CheckOutFrame(frame_out, size_, false); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); jitter_buffer_->ReleaseFrame(frame_out); VCMEncodedFrame* frame_out2 = DecodeCompleteFrame(); - EXPECT_EQ(2700u, frame_out2->TimeStamp()); + EXPECT_EQ(2700u, frame_out2->Timestamp()); CheckOutFrame(frame_out2, size_, false); EXPECT_EQ(kVideoFrameDelta, frame_out2->FrameType()); jitter_buffer_->ReleaseFrame(frame_out2); @@ -1896,13 +1896,13 @@ TEST_F(TestBasicJitterBuffer, Insert2FramesReOrderedWithTimestampWrap) { jitter_buffer_->InsertPacket(*packet_, &retransmitted)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(0xffffff00, frame_out->TimeStamp()); + EXPECT_EQ(0xffffff00, frame_out->Timestamp()); CheckOutFrame(frame_out, size_, false); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); jitter_buffer_->ReleaseFrame(frame_out); VCMEncodedFrame* frame_out2 = DecodeCompleteFrame(); - EXPECT_EQ(2700u, frame_out2->TimeStamp()); + EXPECT_EQ(2700u, frame_out2->Timestamp()); CheckOutFrame(frame_out2, size_, false); EXPECT_EQ(kVideoFrameDelta, frame_out2->FrameType()); jitter_buffer_->ReleaseFrame(frame_out2); @@ -1997,7 +1997,7 @@ TEST_F(TestBasicJitterBuffer, ExceedNumOfFrameWithSeqNumWrap) { jitter_buffer_->InsertPacket(*packet_, &retransmitted)); VCMEncodedFrame* frame_out = DecodeCompleteFrame(); - EXPECT_EQ(first_key_frame_timestamp, frame_out->TimeStamp()); + EXPECT_EQ(first_key_frame_timestamp, frame_out->Timestamp()); CheckOutFrame(frame_out, size_, false); EXPECT_EQ(kVideoFrameKey, frame_out->FrameType()); jitter_buffer_->ReleaseFrame(frame_out); @@ -2023,7 +2023,7 @@ TEST_F(TestBasicJitterBuffer, EmptyLastFrame) { VCMEncodedFrame* testFrame = DecodeIncompleteFrame(); // Timestamp should never be the last TS inserted. if (testFrame != NULL) { - EXPECT_TRUE(testFrame->TimeStamp() < timestamp_); + EXPECT_TRUE(testFrame->Timestamp() < timestamp_); jitter_buffer_->ReleaseFrame(testFrame); } } diff --git a/modules/video_coding/receiver.cc b/modules/video_coding/receiver.cc index a1eeded3b8..4ed61dadbe 100644 --- a/modules/video_coding/receiver.cc +++ b/modules/video_coding/receiver.cc @@ -140,7 +140,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms, jitter_buffer_.NextCompleteFrame(max_wait_time_ms); if (found_frame) { - frame_timestamp = found_frame->TimeStamp(); + frame_timestamp = found_frame->Timestamp(); min_playout_delay_ms = found_frame->EncodedImage().playout_delay_.min_ms; max_playout_delay_ms = found_frame->EncodedImage().playout_delay_.max_ms; } else { @@ -212,7 +212,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms, return NULL; } frame->SetRenderTime(render_time_ms); - TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->TimeStamp(), "SetRenderTS", + TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->Timestamp(), "SetRenderTS", "render_time", frame->RenderTimeMs()); if (!frame->Complete()) { // Update stats for incomplete frames. diff --git a/test/fuzzers/frame_buffer2_fuzzer.cc b/test/fuzzers/frame_buffer2_fuzzer.cc index 57f0c74a7e..2d5830979c 100644 --- a/test/fuzzers/frame_buffer2_fuzzer.cc +++ b/test/fuzzers/frame_buffer2_fuzzer.cc @@ -57,7 +57,6 @@ class FuzzyFrameObject : public video_coding::EncodedFrame { ~FuzzyFrameObject() {} bool GetBitstream(uint8_t* destination) const override { return false; } - uint32_t Timestamp() const override { return timestamp; } int64_t ReceivedTime() const override { return 0; } int64_t RenderTime() const override { return _renderTimeMs; } }; @@ -76,7 +75,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { std::unique_ptr frame(new FuzzyFrameObject()); frame->id.picture_id = reader.GetNum(); frame->id.spatial_layer = reader.GetNum(); - frame->timestamp = reader.GetNum(); + frame->SetTimestamp(reader.GetNum()); frame->num_references = reader.GetNum() % video_coding::EncodedFrame::kMaxFrameReferences; diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc index 19e75a8a3b..ef2d969081 100644 --- a/video/video_stream_decoder_impl.cc +++ b/video/video_stream_decoder_impl.cc @@ -186,7 +186,7 @@ VideoStreamDecoderImpl::DecodeResult VideoStreamDecoderImpl::DecodeNextFrame( } int64_t decode_start_time_ms = rtc::TimeMillis(); - int64_t timestamp = frame->timestamp; + int64_t timestamp = frame->Timestamp(); int64_t render_time_us = frame->RenderTimeMs() * 1000; bookkeeping_queue_.PostTask( [this, decode_start_time_ms, timestamp, render_time_us]() {