mirror of https://github.com/procxx/kepka.git
				
				
				
			Beta version 1.5.16: Remove streaming logs.
This commit is contained in:
		
							parent
							
								
									b8045cbcc7
								
							
						
					
					
						commit
						5efe47cfb6
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -214,7 +214,6 @@ rpl::producer<crl::time> AudioTrack::playPosition() {
 | 
			
		|||
 | 
			
		||||
AudioTrack::~AudioTrack() {
 | 
			
		||||
	if (_audioId.externalPlayId()) {
 | 
			
		||||
		LOG(("mixer()->stop with %1").arg(_audioId.externalPlayId()));
 | 
			
		||||
		Media::Player::mixer()->stop(_audioId);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 <typename Track>
 | 
			
		||||
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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>(_cacheHelper);
 | 
			
		||||
	_owner->cacheBigFile().get(key, [=](QByteArray &&result) {
 | 
			
		||||
| 
						 | 
				
			
			@ -736,24 +735,13 @@ std::optional<Error> 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<crl::semaphore*> 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue