From 5efe47cfb6a1b526b641aaffe01ebe2ee6039270 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 12 Mar 2019 18:56:35 +0400 Subject: [PATCH] Beta version 1.5.16: Remove streaming logs. --- .../SourceFiles/media/audio/media_audio.cpp | 4 --- .../media/audio/media_audio_loaders.cpp | 14 +++++----- .../streaming/media_streaming_audio_track.cpp | 1 - .../streaming/media_streaming_player.cpp | 5 ---- .../streaming/media_streaming_reader.cpp | 26 +------------------ .../streaming/media_streaming_video_track.cpp | 6 ----- 6 files changed, 9 insertions(+), 47 deletions(-) diff --git a/Telegram/SourceFiles/media/audio/media_audio.cpp b/Telegram/SourceFiles/media/audio/media_audio.cpp index 3f2770dbd..60071db78 100644 --- a/Telegram/SourceFiles/media/audio/media_audio.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio.cpp @@ -441,13 +441,11 @@ void Mixer::Track::reattach(AudioMsgId::Type type) { && (state.state != State::PausedAtEnd) && !state.waitingForData) { alSourcef(stream.source, AL_GAIN, ComputeVolume(type)); - LOG(("alSourcePlay: reattach for %1").arg(state.id.externalPlayId())); alSourcePlay(stream.source); if (IsPaused(state.state)) { // We must always start the source if we want the AL_SAMPLE_OFFSET to be applied. // Otherwise it won't be read by alGetSource and we'll get a corrupt position. // So in case of a paused source we start it and then immediately pause it. - LOG(("alSourcePause: reattach for %1").arg(state.id.externalPlayId())); alSourcePause(stream.source); } } @@ -1034,7 +1032,6 @@ void Mixer::resume(const AudioMsgId &audio, bool fast) { alSourcei(track->stream.source, AL_SAMPLE_OFFSET, qMax(track->state.position - track->bufferedPosition, 0LL)); if (!checkCurrentALError(type)) return; } - LOG(("alSourcePlay: resume for: %1").arg(track->state.id.externalPlayId())); alSourcePlay(track->stream.source); if (!checkCurrentALError(type)) return; } @@ -1499,7 +1496,6 @@ int32 Fader::updateOnePlayback(Mixer::Track *track, bool &hasPlaying, bool &hasF track->state.position = fullPosition; emitSignals |= EmitPositionUpdated; } else if (track->state.waitingForData && !waitingForDataOld) { - LOG(("WAITING FOR DATA FOR: %1.").arg(track->state.id.externalPlayId())); if (fullPosition > track->state.position) { track->state.position = fullPosition; } diff --git a/Telegram/SourceFiles/media/audio/media_audio_loaders.cpp b/Telegram/SourceFiles/media/audio/media_audio_loaders.cpp index c0de29ce4..44b3d534b 100644 --- a/Telegram/SourceFiles/media/audio/media_audio_loaders.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio_loaders.cpp @@ -118,15 +118,18 @@ void Loaders::onStart(const AudioMsgId &audio, qint64 positionMs) { AudioMsgId Loaders::clear(AudioMsgId::Type type) { AudioMsgId result; switch (type) { - case AudioMsgId::Type::Voice: std::swap(result, _audio); _audioLoader = nullptr; break; + case AudioMsgId::Type::Voice: + std::swap(result, _audio); + _audioLoader = nullptr; + break; case AudioMsgId::Type::Song: - if (_songLoader) { - LOG(("SONG LOADER KILLED FOR: %1.").arg(_song.externalPlayId())); - } std::swap(result, _song); _songLoader = nullptr; break; - case AudioMsgId::Type::Video: std::swap(result, _video); _videoLoader = nullptr; break; + case AudioMsgId::Type::Video: + std::swap(result, _video); + _videoLoader = nullptr; + break; } return result; } @@ -305,7 +308,6 @@ void Loaders::loadData(AudioMsgId audio, crl::time positionMs) { return; } } - LOG(("alSourcePlay: loader for: %1").arg(track->state.id.externalPlayId())); alSourcePlay(track->stream.source); if (!internal::audioCheckError()) { setStoppedState(track, State::StoppedAtError); diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp index b27a81c9a..f34ff6138 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp @@ -214,7 +214,6 @@ rpl::producer AudioTrack::playPosition() { AudioTrack::~AudioTrack() { if (_audioId.externalPlayId()) { - LOG(("mixer()->stop with %1").arg(_audioId.externalPlayId())); Media::Player::mixer()->stop(_audioId); } } diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp index 02dff1cef..634e7bc40 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp @@ -109,7 +109,6 @@ void Player::checkNextFrameAvailability() { _nextFrameTime = _video->nextFrameDisplayTime(); if (_nextFrameTime != kTimeUnknown) { - LOG(("[%2] RENDERING AT: %1").arg(_nextFrameTime).arg(crl::now())); checkVideoStep(); } } @@ -145,7 +144,6 @@ void Player::trackReceivedTill( } } -static auto wakes = 0; template void Player::trackPlayedTill( const Track &track, @@ -164,7 +162,6 @@ void Player::trackPlayedTill( && (!bothReceivedEnough(loadInAdvanceFor()) || receivedTillEnd())) { _pauseReading = false; _file->wake(); - ++wakes; } } @@ -468,7 +465,6 @@ void Player::updatePausedState() { if (!_paused && _stage == Stage::Ready) { const auto guard = base::make_weak(&_sessionGuard); start(); - LOG(("[%1] STARTED.").arg(crl::now())); if (!guard) { return; } @@ -736,7 +732,6 @@ Player::~Player() { // // So instead of maintaining it in the class definition as well we // simply call stop() here, after that the destruction is trivial. - LOG(("WAKES: %1").arg(wakes)); stop(); } diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp index dd3a90b20..ca8503906 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp @@ -701,7 +701,6 @@ void Reader::readFromCache(int sliceNumber) { if (sliceNumber == 1 && _slices.isGoodHeader()) { return readFromCache(0); } - LOG(("READING FROM CACHE: %1").arg(sliceNumber)); const auto key = _cacheHelper->key(sliceNumber); const auto weak = std::weak_ptr(_cacheHelper); _owner->cacheBigFile().get(key, [=](QByteArray &&result) { @@ -736,24 +735,13 @@ std::optional Reader::failed() const { void Reader::headerDone() { _slices.headerDone(false); } -static auto fills = 0; -static auto several = 0; -static auto fulltime = 0; -static auto maxtime = 0; + bool Reader::fill( int offset, bytes::span buffer, not_null notify) { Expects(offset + buffer.size() <= size()); - const auto now = crl::now(); - const auto guard = gsl::finally([&] { - const auto time = int(crl::now() - now); - fulltime += time; - maxtime = std::max(maxtime, time); - }); - ++fills; - const auto startWaiting = [&] { if (_cacheHelper) { _cacheHelper->waiting = notify.get(); @@ -806,8 +794,6 @@ bool Reader::fillFromSlices(int offset, bytes::span buffer) { readFromCache(sliceNumber); } - ++several; - if (_cacheHelper && result.toCache.number >= 0) { // If we put to cache the header (number == 0) that means we're in // HeaderMode::Good and really are putting the first slice to cache. @@ -832,14 +818,12 @@ void Reader::cancelLoadInRange(int from, int till) { Expects(from < till); for (const auto offset : _loadingOffsets.takeInRange(from, till)) { - LOG(("CANCEL LOAD: %1").arg(offset)); _loader->cancel(offset); } } void Reader::checkLoadWillBeFirst(int offset) { if (_loadingOffsets.front().value_or(offset) != offset) { - LOG(("CHANGING PRIORITY, WAS: %1, NOW: %2").arg(_loadingOffsets.front().value_or(offset)).arg(offset)); _loadingOffsets.increasePriority(); _loader->increasePriority(); } @@ -887,15 +871,9 @@ bool Reader::processLoadedParts() { return !loaded.empty(); } -static auto real = 0; -static auto skip = 0; void Reader::loadAtOffset(int offset) { if (_loadingOffsets.add(offset)) { - LOG(("START LOAD: %1").arg(offset)); _loader->load(offset); - ++real; - } else { - ++skip; } } @@ -916,9 +894,7 @@ void Reader::finalizeCache() { } Reader::~Reader() { - const auto now = crl::now(); finalizeCache(); - LOG(("PARTS: %1, REAL: %2, SKIP: %3, FILLS: %4, TIME: %5, MAX: %6, FINALIZE: %7, REPEATED: %8").arg((_loader->size() + kPartSize - 1) / kPartSize).arg(real).arg(skip).arg(fills).arg(fulltime / float64(fills)).arg(maxtime).arg(crl::now() - now).arg(several)); } } // namespace Streaming diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp index 0192face6..b91cb1d46 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp @@ -199,8 +199,6 @@ auto VideoTrackObject::readEnoughFrames(crl::time trackTime) } else if (!dropStaleFrames || !VideoTrack::IsStale(frame, trackTime)) { return std::nullopt; - } else { - LOG(("[%1] DROPPED FRAMES1, TRACK TIME: %2").arg(crl::now()).arg(trackTime)); } } }, [&](Shared::PrepareNextCheck delay) -> ReadEnoughState { @@ -211,7 +209,6 @@ auto VideoTrackObject::readEnoughFrames(crl::time trackTime) } void VideoTrackObject::loopAround() { - LOG(("LOOPING AROUND")); avcodec_flush_buffers(_stream.codec.get()); _framePositionShift += _stream.duration; } @@ -506,7 +503,6 @@ auto VideoTrack::Shared::prepareState( } else if (!IsDecoded(next)) { return next; } else if (next->position < frame->position) { - LOG(("INVALID ORDER, SWAPPING")); std::swap(*frame, *next); } if (next->position == kFinishedPosition || !dropStaleFrames) { @@ -514,7 +510,6 @@ auto VideoTrack::Shared::prepareState( } else if (IsStale(frame, trackTime)) { std::swap(*frame, *next); next->displayed = kDisplaySkipped; - LOG(("[%1] DROPPED FRAMES2, TRACK TIME: %2").arg(crl::now()).arg(trackTime)); return next; } else { return PrepareNextCheck(frame->position - trackTime + 1); @@ -571,7 +566,6 @@ auto VideoTrack::Shared::presentFrame( const auto trackLeft = position - time.trackTime; frame->display = time.worldTime + crl::time(std::round(trackLeft / playbackSpeed)); - LOG(("[%1] SCHEDULE %5, FRAME POSITION: %2, TRACK TIME: %3, TRACK LEFT: %4").arg(time.worldTime).arg(position).arg(time.trackTime).arg(trackLeft).arg(frame->display)); // Release this frame to the main thread for rendering. _counter.store(