From 72bc8d6df64123bb7a6c86fe00f21e1c5b63ee4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Wed, 12 Sep 2018 10:03:51 +0200 Subject: [PATCH] Make the rtp timestamp member of EncodedImage private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A followup to https://webrtc-review.googlesource.com/c/src/+/82160, which added accessor methods. Bug: webrtc:9378 Change-Id: Id3cff46cde3a5a3fb6d6edd4e8dac26193e6481c Reviewed-on: https://webrtc-review.googlesource.com/95103 Reviewed-by: Sebastian Jansson Reviewed-by: Erik Språng Reviewed-by: Magnus Jedvert Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#24705} --- common_video/include/video_frame.h | 8 +++----- media/engine/simulcast_encoder_adapter_unittest.cc | 2 +- .../codecs/multiplex/multiplex_decoder_adapter.cc | 5 +++-- test/fake_encoder.cc | 2 +- test/fake_vp8_encoder.cc | 7 ++++--- video/send_statistics_proxy.cc | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common_video/include/video_frame.h b/common_video/include/video_frame.h index 371a8f04a2..565870e4dc 100644 --- a/common_video/include/video_frame.h +++ b/common_video/include/video_frame.h @@ -40,10 +40,10 @@ class EncodedImage { // 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; } + void SetTimestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; } // Get frame timestamp (90kHz). - uint32_t Timestamp() const { return _timeStamp; } + uint32_t Timestamp() const { return timestamp_rtp_; } void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms); @@ -60,9 +60,6 @@ class EncodedImage { uint32_t _encodedWidth = 0; uint32_t _encodedHeight = 0; - // TODO(nisse): Make private, once users have been updated - // to use accessor methods. - uint32_t _timeStamp = 0; // NTP time of the capture time in local timebase in milliseconds. int64_t ntp_time_ms_ = 0; int64_t capture_time_ms_ = 0; @@ -93,6 +90,7 @@ class EncodedImage { } timing_; private: + uint32_t timestamp_rtp_ = 0; // -1 means not set. Use a plain int rather than optional, to keep this class // copyable with memcpy. int spatial_index_ = -1; diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc index 3999840a18..8ab7383496 100644 --- a/media/engine/simulcast_encoder_adapter_unittest.cc +++ b/media/engine/simulcast_encoder_adapter_unittest.cc @@ -342,7 +342,7 @@ class TestSimulcastEncoderAdapterFake : public ::testing::Test, last_encoded_image_simulcast_index_ = encoded_image.SpatialIndex().value_or(-1); - return Result(Result::OK, encoded_image._timeStamp); + return Result(Result::OK, encoded_image.Timestamp()); } bool GetLastEncodedImageInfo(int* out_width, diff --git a/modules/video_coding/codecs/multiplex/multiplex_decoder_adapter.cc b/modules/video_coding/codecs/multiplex/multiplex_decoder_adapter.cc index 648e412bba..cc588d0347 100644 --- a/modules/video_coding/codecs/multiplex/multiplex_decoder_adapter.cc +++ b/modules/video_coding/codecs/multiplex/multiplex_decoder_adapter.cc @@ -131,10 +131,11 @@ int32_t MultiplexDecoderAdapter::Decode( MultiplexImage image = MultiplexEncodedImagePacker::Unpack(input_image); if (supports_augmenting_data_) { - RTC_DCHECK(decoded_augmenting_data_.find(input_image._timeStamp) == + RTC_DCHECK(decoded_augmenting_data_.find(input_image.Timestamp()) == decoded_augmenting_data_.end()); decoded_augmenting_data_.emplace( - std::piecewise_construct, std::forward_as_tuple(input_image._timeStamp), + std::piecewise_construct, + std::forward_as_tuple(input_image.Timestamp()), std::forward_as_tuple(std::move(image.augmenting_data), image.augmenting_data_size)); } diff --git a/test/fake_encoder.cc b/test/fake_encoder.cc index 2075399dd9..b02d6c160f 100644 --- a/test/fake_encoder.cc +++ b/test/fake_encoder.cc @@ -107,7 +107,7 @@ int32_t FakeEncoder::Encode(const VideoFrame& input_image, memcpy(encoded_buffer.get(), encoded_buffer_, frame_info.layers[i].size); EncodedImage encoded(encoded_buffer.get(), frame_info.layers[i].size, sizeof(encoded_buffer_)); - encoded._timeStamp = input_image.timestamp(); + encoded.SetTimestamp(input_image.timestamp()); encoded.capture_time_ms_ = input_image.render_time_ms(); encoded._frameType = frame_info.keyframe ? kVideoFrameKey : kVideoFrameDelta; diff --git a/test/fake_vp8_encoder.cc b/test/fake_vp8_encoder.cc index 04dff00c42..afd16d4e1e 100644 --- a/test/fake_vp8_encoder.cc +++ b/test/fake_vp8_encoder.cc @@ -102,11 +102,12 @@ EncodedImageCallback::Result FakeVP8Encoder::OnEncodedImage( uint8_t stream_idx = encoded_image.SpatialIndex().value_or(0); CodecSpecificInfo overrided_specific_info; TemporalLayers::FrameConfig tl_config = - temporal_layers_[stream_idx]->UpdateLayerConfig(encoded_image._timeStamp); + temporal_layers_[stream_idx]->UpdateLayerConfig( + encoded_image.Timestamp()); PopulateCodecSpecific(&overrided_specific_info, tl_config, encoded_image._frameType, stream_idx, - encoded_image._timeStamp); - temporal_layers_[stream_idx]->FrameEncoded(encoded_image._timeStamp, + encoded_image.Timestamp()); + temporal_layers_[stream_idx]->FrameEncoded(encoded_image.Timestamp(), encoded_image._length, -1); return callback_->OnEncodedImage(encoded_image, &overrided_specific_info, diff --git a/video/send_statistics_proxy.cc b/video/send_statistics_proxy.cc index fe4d887a2d..a80b5a593e 100644 --- a/video/send_statistics_proxy.cc +++ b/video/send_statistics_proxy.cc @@ -260,7 +260,7 @@ bool SendStatisticsProxy::UmaSamplesContainer::InsertEncodedFrame( } } - auto it = encoded_frames_.find(encoded_frame._timeStamp); + auto it = encoded_frames_.find(encoded_frame.Timestamp()); if (it == encoded_frames_.end()) { // First frame with this timestamp. encoded_frames_.insert(