diff --git a/api/video/video_frame.cc b/api/video/video_frame.cc index 93b3c9c6b9..e8fb29d742 100644 --- a/api/video/video_frame.cc +++ b/api/video/video_frame.cc @@ -25,11 +25,11 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr& buffer, rotation_(rotation) {} VideoFrame::VideoFrame(const rtc::scoped_refptr& buffer, - uint32_t timestamp, + uint32_t timestamp_rtp, int64_t render_time_ms, VideoRotation rotation) : video_frame_buffer_(buffer), - timestamp_rtp_(timestamp), + timestamp_rtp_(timestamp_rtp), ntp_time_ms_(0), timestamp_us_(render_time_ms * rtc::kNumMicrosecsPerMillisec), rotation_(rotation) { diff --git a/api/video/video_frame.h b/api/video/video_frame.h index a72bef1d32..bd5482025a 100644 --- a/api/video/video_frame.h +++ b/api/video/video_frame.h @@ -20,16 +20,14 @@ namespace webrtc { class VideoFrame { public: - // TODO(nisse): This constructor is consistent with the now deleted - // cricket::WebRtcVideoFrame. We should consider whether or not we - // want to stick to this style and deprecate the other constructor. + // Preferred constructor. VideoFrame(const rtc::scoped_refptr& buffer, webrtc::VideoRotation rotation, int64_t timestamp_us); - // Preferred constructor. + // For use by the parts of the pipeline that needs the RTP 90kHz timestamp. VideoFrame(const rtc::scoped_refptr& buffer, - uint32_t timestamp, + uint32_t timestamp_rtp, int64_t render_time_ms, VideoRotation rotation); diff --git a/media/engine/fakewebrtcvideocapturemodule.h b/media/engine/fakewebrtcvideocapturemodule.h index cd6f25bd56..0778abbcaa 100644 --- a/media/engine/fakewebrtcvideocapturemodule.h +++ b/media/engine/fakewebrtcvideocapturemodule.h @@ -70,8 +70,8 @@ class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { // Initialize memory to satisfy DrMemory tests. See // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 buffer->InitializeData(); - callback_->OnFrame( - webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); + callback_->OnFrame(webrtc::VideoFrame(buffer, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); }); } diff --git a/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc b/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc index cf0d5e0e1f..931892ee38 100644 --- a/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc +++ b/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc @@ -158,7 +158,8 @@ void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame(int expected_ret) { I420Buffer::SetBlack(buffer); std::vector types(1, kVideoFrameKey); - frame_.reset(new VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); + frame_.reset( + new VideoFrame(buffer, webrtc::kVideoRotation_0, 0 /* timestamp_us */)); EXPECT_EQ(expected_ret, fallback_wrapper_.Encode(*frame_, nullptr, &types)); } diff --git a/modules/video_capture/test/video_capture_unittest.cc b/modules/video_capture/test/video_capture_unittest.cc index 16330b616f..1c6d06480d 100644 --- a/modules/video_capture/test/video_capture_unittest.cc +++ b/modules/video_capture/test/video_capture_unittest.cc @@ -370,8 +370,8 @@ class VideoCaptureExternalTest : public testing::Test { buffer->ChromaHeight() * buffer->StrideU()); memset(buffer->MutableDataV(), 127, buffer->ChromaHeight() * buffer->StrideV()); - test_frame_.reset( - new webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); + test_frame_.reset(new webrtc::VideoFrame(buffer, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp. diff --git a/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/modules/video_coding/codecs/h264/h264_decoder_impl.cc index 737194cadf..c560056880 100644 --- a/modules/video_coding/codecs/h264/h264_decoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_decoder_impl.cc @@ -137,9 +137,8 @@ int H264DecoderImpl::AVGetBuffer2( total_size, AVFreeBuffer2, static_cast(new VideoFrame(frame_buffer, - 0 /* timestamp */, - 0 /* render_time_ms */, - kVideoRotation_0)), + kVideoRotation_0, + 0 /* timestamp_us */)), 0); RTC_CHECK(av_frame->buf[0]); return 0; diff --git a/modules/video_coding/codecs/multiplex/test/multiplex_adapter_unittest.cc b/modules/video_coding/codecs/multiplex/test/multiplex_adapter_unittest.cc index 1e141d7dc0..49afe01def 100644 --- a/modules/video_coding/codecs/multiplex/test/multiplex_adapter_unittest.cc +++ b/modules/video_coding/codecs/multiplex/test/multiplex_adapter_unittest.cc @@ -66,7 +66,7 @@ class TestMultiplexAdapter : public VideoCodecUnitTest { yuv_buffer->DataV(), yuv_buffer->StrideV(), yuv_buffer->DataY(), yuv_buffer->StrideY(), rtc::KeepRefUntilDone(yuv_buffer)); return rtc::WrapUnique( - new VideoFrame(yuva_buffer, 123 /* timestamp_us */, + new VideoFrame(yuva_buffer, 123 /* RTP timestamp */, 345 /* render_time_ms */, kVideoRotation_0)); } @@ -79,7 +79,7 @@ class TestMultiplexAdapter : public VideoCodecUnitTest { yuva_buffer->DataV(), yuva_buffer->StrideV(), rtc::KeepRefUntilDone(yuva_frame.video_frame_buffer())); return rtc::WrapUnique( - new VideoFrame(axx_buffer, 123 /* timestamp_us */, + new VideoFrame(axx_buffer, 123 /* RTP timestamp */, 345 /* render_time_ms */, kVideoRotation_0)); } diff --git a/modules/video_coding/codecs/vp8/simulcast_test_fixture_impl.cc b/modules/video_coding/codecs/vp8/simulcast_test_fixture_impl.cc index 422fd48ea5..361a5a61fd 100644 --- a/modules/video_coding/codecs/vp8/simulcast_test_fixture_impl.cc +++ b/modules/video_coding/codecs/vp8/simulcast_test_fixture_impl.cc @@ -261,8 +261,8 @@ void SimulcastTestFixtureImpl::SetUpCodec(const int* temporal_layer_profile) { EXPECT_EQ(0, decoder_->InitDecode(&settings_, 1)); input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight); input_buffer_->InitializeData(); - input_frame_.reset( - new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); + input_frame_.reset(new VideoFrame(input_buffer_, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); } void SimulcastTestFixtureImpl::SetUpRateAllocator() { @@ -575,8 +575,8 @@ void SimulcastTestFixtureImpl::SwitchingToOneStream(int width, int height) { input_buffer_ = I420Buffer::Create(settings_.width, settings_.height); input_buffer_->InitializeData(); - input_frame_.reset( - new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); + input_frame_.reset(new VideoFrame(input_buffer_, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); // The for loop above did not set the bitrate of the highest layer. settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].maxBitrate = @@ -615,8 +615,8 @@ void SimulcastTestFixtureImpl::SwitchingToOneStream(int width, int height) { // Resize |input_frame_| to the new resolution. input_buffer_ = I420Buffer::Create(settings_.width, settings_.height); input_buffer_->InitializeData(); - input_frame_.reset( - new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); + input_frame_.reset(new VideoFrame(input_buffer_, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types)); } @@ -773,8 +773,8 @@ void SimulcastTestFixtureImpl::TestStrideEncodeDecode() { int stride_uv = ((kDefaultWidth + 1) / 2) + 5; input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight, stride_y, stride_uv, stride_uv); - input_frame_.reset( - new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); + input_frame_.reset(new VideoFrame(input_buffer_, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); // Set color. int plane_offset[kNumOfPlanes]; diff --git a/test/frame_generator.cc b/test/frame_generator.cc index 41e197129f..040192db01 100644 --- a/test/frame_generator.cc +++ b/test/frame_generator.cc @@ -90,7 +90,8 @@ class SquareGenerator : public FrameGenerator { for (const auto& square : squares_) square->Draw(buffer); - frame_.reset(new VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); + frame_.reset( + new VideoFrame(buffer, webrtc::kVideoRotation_0, 0 /* timestamp_us */)); return frame_.get(); } @@ -192,8 +193,8 @@ class YuvFileGenerator : public FrameGenerator { if (++current_display_count_ >= frame_display_count_) current_display_count_ = 0; - temp_frame_.reset( - new VideoFrame(last_read_buffer_, 0, 0, webrtc::kVideoRotation_0)); + temp_frame_.reset(new VideoFrame( + last_read_buffer_, webrtc::kVideoRotation_0, 0 /* timestamp_us */)); return temp_frame_.get(); } @@ -249,8 +250,8 @@ class SlideGenerator : public FrameGenerator { if (++current_display_count_ >= frame_display_count_) current_display_count_ = 0; - frame_.reset( - new VideoFrame(buffer_, 0, 0, webrtc::kVideoRotation_0)); + frame_.reset(new VideoFrame(buffer_, webrtc::kVideoRotation_0, + 0 /* timestamp_us */)); return frame_.get(); }