diff options
author | Yuri Wiitala <miu@chromium.org> | 2020-12-15 16:10:21 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-16 01:10:34 +0000 |
commit | 8b06ad0ebb9a026fc502d42eb39fe7fe30e75589 (patch) | |
tree | cf5d44ff257d6e8d0f400207eed8377b02d42e9f /cast | |
parent | f4d58e1468e4bb79ab5c9374cc4f800859643287 (diff) | |
download | openscreen-8b06ad0ebb9a026fc502d42eb39fe7fe30e75589.tar.gz |
Fix some places that became microseconds but are supposed to be millis.
The refactoring in commit c9201dd611b0aa8d66fe7ef2749c7ce0c157f0a1
accidentally replaced some time conversions/definitions that were
milliseconds with microseconds.
Change-Id: Ie7f329060b77064ce41acf72696a99c4f88b2104
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2594219
Commit-Queue: Jordan Bayles <jophba@chromium.org>
Reviewed-by: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast')
-rw-r--r-- | cast/standalone_receiver/dummy_player.cc | 2 | ||||
-rw-r--r-- | cast/standalone_receiver/sdl_player_base.cc | 2 | ||||
-rw-r--r-- | cast/standalone_sender/looping_file_sender.cc | 2 | ||||
-rw-r--r-- | cast/standalone_sender/main.cc | 3 | ||||
-rw-r--r-- | cast/standalone_sender/streaming_opus_encoder.cc | 4 | ||||
-rw-r--r-- | cast/streaming/ntp_time_unittest.cc | 16 | ||||
-rw-r--r-- | cast/streaming/sender_packet_router.cc | 2 |
7 files changed, 16 insertions, 15 deletions
diff --git a/cast/standalone_receiver/dummy_player.cc b/cast/standalone_receiver/dummy_player.cc index 512ea7da..ce54d82f 100644 --- a/cast/standalone_receiver/dummy_player.cc +++ b/cast/standalone_receiver/dummy_player.cc @@ -32,7 +32,7 @@ void DummyPlayer::OnFramesReady(int buffer_size) { // Convert the RTP timestamp to a human-readable timestamp (in µs) and log // some short information about the frame. const auto media_timestamp = - frame.rtp_timestamp.ToTimeSinceOrigin<std::chrono::microseconds>( + frame.rtp_timestamp.ToTimeSinceOrigin<microseconds>( receiver_->rtp_timebase()); OSP_LOG_INFO << "[SSRC " << receiver_->ssrc() << "] " << (frame.dependency == EncodedFrame::KEY_FRAME ? "KEY " : "") diff --git a/cast/standalone_receiver/sdl_player_base.cc b/cast/standalone_receiver/sdl_player_base.cc index fdc3c065..76ddb7bd 100644 --- a/cast/standalone_receiver/sdl_player_base.cc +++ b/cast/standalone_receiver/sdl_player_base.cc @@ -74,7 +74,7 @@ Clock::time_point SDLPlayerBase::ResyncAndDeterminePresentationTime( .ToDuration<Clock::duration>(receiver_->rtp_timebase()); Clock::time_point presentation_time = last_sync_reference_time_ + media_time_since_last_sync; - const auto drift = to_microseconds(frame.reference_time - presentation_time); + const auto drift = to_milliseconds(frame.reference_time - presentation_time); if (drift > kMaxPlayoutDrift || drift < -kMaxPlayoutDrift) { // Only log if not the very first frame. OSP_LOG_IF(INFO, frame.frame_id != FrameId::first()) diff --git a/cast/standalone_sender/looping_file_sender.cc b/cast/standalone_sender/looping_file_sender.cc index 90720106..67aff23b 100644 --- a/cast/standalone_sender/looping_file_sender.cc +++ b/cast/standalone_sender/looping_file_sender.cc @@ -132,7 +132,7 @@ void LoopingFileSender::OnVideoFrame(const AVFrame& av_frame, void LoopingFileSender::UpdateStatusOnConsole() { const Clock::duration elapsed = latest_frame_time_ - capture_start_time_; const auto seconds_part = to_seconds(elapsed); - const auto millis_part = to_microseconds(elapsed - seconds_part); + const auto millis_part = to_milliseconds(elapsed - seconds_part); // The control codes here attempt to erase the current line the cursor is // on, and then print out the updated status text. If the terminal does not // support simple ANSI escape codes, the following will still work, but diff --git a/cast/standalone_sender/main.cc b/cast/standalone_sender/main.cc index 3a0dca6d..da7ed24c 100644 --- a/cast/standalone_sender/main.cc +++ b/cast/standalone_sender/main.cc @@ -26,6 +26,7 @@ #include "platform/impl/platform_client_posix.h" #include "platform/impl/task_runner.h" #include "platform/impl/text_trace_logging_platform.h" +#include "util/chrono_helpers.h" #include "util/stringprintf.h" namespace openscreen { @@ -173,7 +174,7 @@ int StandaloneSenderMain(int argc, char* argv[]) { #endif auto* const task_runner = new TaskRunnerImpl(&Clock::now); - PlatformClientPosix::Create(Clock::duration{50}, Clock::duration{50}, + PlatformClientPosix::Create(milliseconds(50), milliseconds(50), std::unique_ptr<TaskRunnerImpl>(task_runner)); IPEndpoint remote_endpoint = ParseAsEndpoint(iface_or_endpoint); diff --git a/cast/standalone_sender/streaming_opus_encoder.cc b/cast/standalone_sender/streaming_opus_encoder.cc index b41b2a82..cb2286ee 100644 --- a/cast/standalone_sender/streaming_opus_encoder.cc +++ b/cast/standalone_sender/streaming_opus_encoder.cc @@ -35,8 +35,8 @@ StreamingOpusEncoder::StreamingOpusEncoder(int num_channels, : num_channels_(num_channels), sender_(sender), samples_per_cast_frame_(sample_rate() / cast_frames_per_second), - approximate_cast_frame_duration_( - Clock::to_duration(std::chrono::seconds(1)) / cast_frames_per_second), + approximate_cast_frame_duration_(Clock::to_duration(seconds(1)) / + cast_frames_per_second), encoder_storage_(new uint8_t[opus_encoder_get_size(num_channels_)]), input_(new float[num_channels_ * samples_per_cast_frame_]), output_(new uint8_t[kOpusMaxPayloadSize]) { diff --git a/cast/streaming/ntp_time_unittest.cc b/cast/streaming/ntp_time_unittest.cc index 325e7587..b8f9ce00 100644 --- a/cast/streaming/ntp_time_unittest.cc +++ b/cast/streaming/ntp_time_unittest.cc @@ -21,7 +21,7 @@ TEST(NtpTimestampTest, SplitsIntoParts) { // 1 Jan 1900 plus 10 ms. timestamp = UINT64_C(0x00000000028f5c29); EXPECT_EQ(NtpSeconds::zero(), NtpSecondsPart(timestamp)); - EXPECT_EQ(milliseconds(10), to_microseconds(NtpFractionPart(timestamp))); + EXPECT_EQ(milliseconds(10), to_milliseconds(NtpFractionPart(timestamp))); // 1 Jan 1970 minus 2^-32 seconds. timestamp = UINT64_C(0x83aa7e80ffffffff); @@ -31,7 +31,7 @@ TEST(NtpTimestampTest, SplitsIntoParts) { // 2019-03-23 17:25:50.500. timestamp = UINT64_C(0xe0414d0e80000000); EXPECT_EQ(NtpSeconds(INT64_C(3762375950)), NtpSecondsPart(timestamp)); - EXPECT_EQ(milliseconds(500), to_microseconds(NtpFractionPart(timestamp))); + EXPECT_EQ(milliseconds(500), to_milliseconds(NtpFractionPart(timestamp))); } TEST(NtpTimestampTest, AssemblesFromParts) { @@ -40,11 +40,11 @@ TEST(NtpTimestampTest, AssemblesFromParts) { AssembleNtpTimestamp(NtpSeconds::zero(), NtpFraction::zero()); EXPECT_EQ(UINT64_C(0x0000000000000000), timestamp); - // 1 Jan 1900 plus 10 ms. Note that the - // std::chrono::duration_cast<NtpFraction>(10ms) truncates rather than rounds - // the 10ms value, so the resulting timestamp is one fractional tick less than - // the one found in the SplitsIntoParts test. The ~0.4 nanosecond error in the - // conversion is totally insignificant to a live system. + // 1 Jan 1900 plus 10 ms. Note that the duration_cast<NtpFraction>(10ms) + // truncates rather than rounds the 10ms value, so the resulting timestamp is + // one fractional tick less than the one found in the SplitsIntoParts test. + // The ~0.4 nanosecond error in the conversion is totally insignificant to a + // live system. timestamp = AssembleNtpTimestamp( NtpSeconds::zero(), std::chrono::duration_cast<NtpFraction>(milliseconds(10))); @@ -70,7 +70,7 @@ TEST(NtpTimeConverterTest, ConvertsToNtpTimeAndBack) { // our core assumptions (or the design) about the time math are wrong and // should be looked into! const Clock::time_point steady_clock_start = Clock::now(); - const std::chrono::seconds wall_clock_start = GetWallTimeSinceUnixEpoch(); + const seconds wall_clock_start = GetWallTimeSinceUnixEpoch(); SCOPED_TRACE(::testing::Message() << "steady_clock_start.time_since_epoch().count() is " << steady_clock_start.time_since_epoch().count() diff --git a/cast/streaming/sender_packet_router.cc b/cast/streaming/sender_packet_router.cc index c3fccd18..c2b23dbf 100644 --- a/cast/streaming/sender_packet_router.cc +++ b/cast/streaming/sender_packet_router.cc @@ -224,7 +224,7 @@ int SenderPacketRouter::SendJustTheRtpPackets(Clock::time_point send_time, namespace { constexpr int kBitsPerByte = 8; -constexpr auto kOneSecondInMilliseconds = to_microseconds(seconds(1)); +constexpr auto kOneSecondInMilliseconds = to_milliseconds(seconds(1)); } // namespace // static |