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.state != State::PausedAtEnd)
 | 
				
			||||||
		&& !state.waitingForData) {
 | 
							&& !state.waitingForData) {
 | 
				
			||||||
		alSourcef(stream.source, AL_GAIN, ComputeVolume(type));
 | 
							alSourcef(stream.source, AL_GAIN, ComputeVolume(type));
 | 
				
			||||||
		LOG(("alSourcePlay: reattach for %1").arg(state.id.externalPlayId()));
 | 
					 | 
				
			||||||
		alSourcePlay(stream.source);
 | 
							alSourcePlay(stream.source);
 | 
				
			||||||
		if (IsPaused(state.state)) {
 | 
							if (IsPaused(state.state)) {
 | 
				
			||||||
			// We must always start the source if we want the AL_SAMPLE_OFFSET to be applied.
 | 
								// 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.
 | 
								// 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.
 | 
								// 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);
 | 
								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));
 | 
											alSourcei(track->stream.source, AL_SAMPLE_OFFSET, qMax(track->state.position - track->bufferedPosition, 0LL));
 | 
				
			||||||
						if (!checkCurrentALError(type)) return;
 | 
											if (!checkCurrentALError(type)) return;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					LOG(("alSourcePlay: resume for: %1").arg(track->state.id.externalPlayId()));
 | 
					 | 
				
			||||||
					alSourcePlay(track->stream.source);
 | 
										alSourcePlay(track->stream.source);
 | 
				
			||||||
					if (!checkCurrentALError(type)) return;
 | 
										if (!checkCurrentALError(type)) return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -1499,7 +1496,6 @@ int32 Fader::updateOnePlayback(Mixer::Track *track, bool &hasPlaying, bool &hasF
 | 
				
			||||||
		track->state.position = fullPosition;
 | 
							track->state.position = fullPosition;
 | 
				
			||||||
		emitSignals |= EmitPositionUpdated;
 | 
							emitSignals |= EmitPositionUpdated;
 | 
				
			||||||
	} else if (track->state.waitingForData && !waitingForDataOld) {
 | 
						} else if (track->state.waitingForData && !waitingForDataOld) {
 | 
				
			||||||
		LOG(("WAITING FOR DATA FOR: %1.").arg(track->state.id.externalPlayId()));
 | 
					 | 
				
			||||||
		if (fullPosition > track->state.position) {
 | 
							if (fullPosition > track->state.position) {
 | 
				
			||||||
			track->state.position = fullPosition;
 | 
								track->state.position = fullPosition;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,15 +118,18 @@ void Loaders::onStart(const AudioMsgId &audio, qint64 positionMs) {
 | 
				
			||||||
AudioMsgId Loaders::clear(AudioMsgId::Type type) {
 | 
					AudioMsgId Loaders::clear(AudioMsgId::Type type) {
 | 
				
			||||||
	AudioMsgId result;
 | 
						AudioMsgId result;
 | 
				
			||||||
	switch (type) {
 | 
						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:
 | 
						case AudioMsgId::Type::Song:
 | 
				
			||||||
		if (_songLoader) {
 | 
					 | 
				
			||||||
			LOG(("SONG LOADER KILLED FOR: %1.").arg(_song.externalPlayId()));
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		std::swap(result, _song);
 | 
							std::swap(result, _song);
 | 
				
			||||||
		_songLoader = nullptr;
 | 
							_songLoader = nullptr;
 | 
				
			||||||
		break;
 | 
							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;
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -305,7 +308,6 @@ void Loaders::loadData(AudioMsgId audio, crl::time positionMs) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	LOG(("alSourcePlay: loader for: %1").arg(track->state.id.externalPlayId()));
 | 
					 | 
				
			||||||
	alSourcePlay(track->stream.source);
 | 
						alSourcePlay(track->stream.source);
 | 
				
			||||||
	if (!internal::audioCheckError()) {
 | 
						if (!internal::audioCheckError()) {
 | 
				
			||||||
		setStoppedState(track, State::StoppedAtError);
 | 
							setStoppedState(track, State::StoppedAtError);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -214,7 +214,6 @@ rpl::producer<crl::time> AudioTrack::playPosition() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AudioTrack::~AudioTrack() {
 | 
					AudioTrack::~AudioTrack() {
 | 
				
			||||||
	if (_audioId.externalPlayId()) {
 | 
						if (_audioId.externalPlayId()) {
 | 
				
			||||||
		LOG(("mixer()->stop with %1").arg(_audioId.externalPlayId()));
 | 
					 | 
				
			||||||
		Media::Player::mixer()->stop(_audioId);
 | 
							Media::Player::mixer()->stop(_audioId);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,7 +109,6 @@ void Player::checkNextFrameAvailability() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_nextFrameTime = _video->nextFrameDisplayTime();
 | 
						_nextFrameTime = _video->nextFrameDisplayTime();
 | 
				
			||||||
	if (_nextFrameTime != kTimeUnknown) {
 | 
						if (_nextFrameTime != kTimeUnknown) {
 | 
				
			||||||
		LOG(("[%2] RENDERING AT: %1").arg(_nextFrameTime).arg(crl::now()));
 | 
					 | 
				
			||||||
		checkVideoStep();
 | 
							checkVideoStep();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -145,7 +144,6 @@ void Player::trackReceivedTill(
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static auto wakes = 0;
 | 
					 | 
				
			||||||
template <typename Track>
 | 
					template <typename Track>
 | 
				
			||||||
void Player::trackPlayedTill(
 | 
					void Player::trackPlayedTill(
 | 
				
			||||||
		const Track &track,
 | 
							const Track &track,
 | 
				
			||||||
| 
						 | 
					@ -164,7 +162,6 @@ void Player::trackPlayedTill(
 | 
				
			||||||
		&& (!bothReceivedEnough(loadInAdvanceFor()) || receivedTillEnd())) {
 | 
							&& (!bothReceivedEnough(loadInAdvanceFor()) || receivedTillEnd())) {
 | 
				
			||||||
		_pauseReading = false;
 | 
							_pauseReading = false;
 | 
				
			||||||
		_file->wake();
 | 
							_file->wake();
 | 
				
			||||||
		++wakes;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -468,7 +465,6 @@ void Player::updatePausedState() {
 | 
				
			||||||
	if (!_paused && _stage == Stage::Ready) {
 | 
						if (!_paused && _stage == Stage::Ready) {
 | 
				
			||||||
		const auto guard = base::make_weak(&_sessionGuard);
 | 
							const auto guard = base::make_weak(&_sessionGuard);
 | 
				
			||||||
		start();
 | 
							start();
 | 
				
			||||||
		LOG(("[%1] STARTED.").arg(crl::now()));
 | 
					 | 
				
			||||||
		if (!guard) {
 | 
							if (!guard) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -736,7 +732,6 @@ Player::~Player() {
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// So instead of maintaining it in the class definition as well we
 | 
						// So instead of maintaining it in the class definition as well we
 | 
				
			||||||
	// simply call stop() here, after that the destruction is trivial.
 | 
						// simply call stop() here, after that the destruction is trivial.
 | 
				
			||||||
	LOG(("WAKES: %1").arg(wakes));
 | 
					 | 
				
			||||||
	stop();
 | 
						stop();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -701,7 +701,6 @@ void Reader::readFromCache(int sliceNumber) {
 | 
				
			||||||
	if (sliceNumber == 1 && _slices.isGoodHeader()) {
 | 
						if (sliceNumber == 1 && _slices.isGoodHeader()) {
 | 
				
			||||||
		return readFromCache(0);
 | 
							return readFromCache(0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	LOG(("READING FROM CACHE: %1").arg(sliceNumber));
 | 
					 | 
				
			||||||
	const auto key = _cacheHelper->key(sliceNumber);
 | 
						const auto key = _cacheHelper->key(sliceNumber);
 | 
				
			||||||
	const auto weak = std::weak_ptr<CacheHelper>(_cacheHelper);
 | 
						const auto weak = std::weak_ptr<CacheHelper>(_cacheHelper);
 | 
				
			||||||
	_owner->cacheBigFile().get(key, [=](QByteArray &&result) {
 | 
						_owner->cacheBigFile().get(key, [=](QByteArray &&result) {
 | 
				
			||||||
| 
						 | 
					@ -736,24 +735,13 @@ std::optional<Error> Reader::failed() const {
 | 
				
			||||||
void Reader::headerDone() {
 | 
					void Reader::headerDone() {
 | 
				
			||||||
	_slices.headerDone(false);
 | 
						_slices.headerDone(false);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static auto fills = 0;
 | 
					
 | 
				
			||||||
static auto several = 0;
 | 
					 | 
				
			||||||
static auto fulltime = 0;
 | 
					 | 
				
			||||||
static auto maxtime = 0;
 | 
					 | 
				
			||||||
bool Reader::fill(
 | 
					bool Reader::fill(
 | 
				
			||||||
		int offset,
 | 
							int offset,
 | 
				
			||||||
		bytes::span buffer,
 | 
							bytes::span buffer,
 | 
				
			||||||
		not_null<crl::semaphore*> notify) {
 | 
							not_null<crl::semaphore*> notify) {
 | 
				
			||||||
	Expects(offset + buffer.size() <= size());
 | 
						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 = [&] {
 | 
						const auto startWaiting = [&] {
 | 
				
			||||||
		if (_cacheHelper) {
 | 
							if (_cacheHelper) {
 | 
				
			||||||
			_cacheHelper->waiting = notify.get();
 | 
								_cacheHelper->waiting = notify.get();
 | 
				
			||||||
| 
						 | 
					@ -806,8 +794,6 @@ bool Reader::fillFromSlices(int offset, bytes::span buffer) {
 | 
				
			||||||
		readFromCache(sliceNumber);
 | 
							readFromCache(sliceNumber);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	++several;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (_cacheHelper && result.toCache.number >= 0) {
 | 
						if (_cacheHelper && result.toCache.number >= 0) {
 | 
				
			||||||
		// If we put to cache the header (number == 0) that means we're in
 | 
							// 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.
 | 
							// 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);
 | 
						Expects(from < till);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (const auto offset : _loadingOffsets.takeInRange(from, till)) {
 | 
						for (const auto offset : _loadingOffsets.takeInRange(from, till)) {
 | 
				
			||||||
		LOG(("CANCEL LOAD: %1").arg(offset));
 | 
					 | 
				
			||||||
		_loader->cancel(offset);
 | 
							_loader->cancel(offset);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Reader::checkLoadWillBeFirst(int offset) {
 | 
					void Reader::checkLoadWillBeFirst(int offset) {
 | 
				
			||||||
	if (_loadingOffsets.front().value_or(offset) != 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();
 | 
							_loadingOffsets.increasePriority();
 | 
				
			||||||
		_loader->increasePriority();
 | 
							_loader->increasePriority();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -887,15 +871,9 @@ bool Reader::processLoadedParts() {
 | 
				
			||||||
	return !loaded.empty();
 | 
						return !loaded.empty();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static auto real = 0;
 | 
					 | 
				
			||||||
static auto skip = 0;
 | 
					 | 
				
			||||||
void Reader::loadAtOffset(int offset) {
 | 
					void Reader::loadAtOffset(int offset) {
 | 
				
			||||||
	if (_loadingOffsets.add(offset)) {
 | 
						if (_loadingOffsets.add(offset)) {
 | 
				
			||||||
		LOG(("START LOAD: %1").arg(offset));
 | 
					 | 
				
			||||||
		_loader->load(offset);
 | 
							_loader->load(offset);
 | 
				
			||||||
		++real;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		++skip;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -916,9 +894,7 @@ void Reader::finalizeCache() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Reader::~Reader() {
 | 
					Reader::~Reader() {
 | 
				
			||||||
	const auto now = crl::now();
 | 
					 | 
				
			||||||
	finalizeCache();
 | 
						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
 | 
					} // namespace Streaming
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -199,8 +199,6 @@ auto VideoTrackObject::readEnoughFrames(crl::time trackTime)
 | 
				
			||||||
			} else if (!dropStaleFrames
 | 
								} else if (!dropStaleFrames
 | 
				
			||||||
				|| !VideoTrack::IsStale(frame, trackTime)) {
 | 
									|| !VideoTrack::IsStale(frame, trackTime)) {
 | 
				
			||||||
				return std::nullopt;
 | 
									return std::nullopt;
 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				LOG(("[%1] DROPPED FRAMES1, TRACK TIME: %2").arg(crl::now()).arg(trackTime));
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}, [&](Shared::PrepareNextCheck delay) -> ReadEnoughState {
 | 
						}, [&](Shared::PrepareNextCheck delay) -> ReadEnoughState {
 | 
				
			||||||
| 
						 | 
					@ -211,7 +209,6 @@ auto VideoTrackObject::readEnoughFrames(crl::time trackTime)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VideoTrackObject::loopAround() {
 | 
					void VideoTrackObject::loopAround() {
 | 
				
			||||||
	LOG(("LOOPING AROUND"));
 | 
					 | 
				
			||||||
	avcodec_flush_buffers(_stream.codec.get());
 | 
						avcodec_flush_buffers(_stream.codec.get());
 | 
				
			||||||
	_framePositionShift += _stream.duration;
 | 
						_framePositionShift += _stream.duration;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -506,7 +503,6 @@ auto VideoTrack::Shared::prepareState(
 | 
				
			||||||
		} else if (!IsDecoded(next)) {
 | 
							} else if (!IsDecoded(next)) {
 | 
				
			||||||
			return next;
 | 
								return next;
 | 
				
			||||||
		} else if (next->position < frame->position) {
 | 
							} else if (next->position < frame->position) {
 | 
				
			||||||
			LOG(("INVALID ORDER, SWAPPING"));
 | 
					 | 
				
			||||||
			std::swap(*frame, *next);
 | 
								std::swap(*frame, *next);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (next->position == kFinishedPosition || !dropStaleFrames) {
 | 
							if (next->position == kFinishedPosition || !dropStaleFrames) {
 | 
				
			||||||
| 
						 | 
					@ -514,7 +510,6 @@ auto VideoTrack::Shared::prepareState(
 | 
				
			||||||
		} else if (IsStale(frame, trackTime)) {
 | 
							} else if (IsStale(frame, trackTime)) {
 | 
				
			||||||
			std::swap(*frame, *next);
 | 
								std::swap(*frame, *next);
 | 
				
			||||||
			next->displayed = kDisplaySkipped;
 | 
								next->displayed = kDisplaySkipped;
 | 
				
			||||||
			LOG(("[%1] DROPPED FRAMES2, TRACK TIME: %2").arg(crl::now()).arg(trackTime));
 | 
					 | 
				
			||||||
			return next;
 | 
								return next;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			return PrepareNextCheck(frame->position - trackTime + 1);
 | 
								return PrepareNextCheck(frame->position - trackTime + 1);
 | 
				
			||||||
| 
						 | 
					@ -571,7 +566,6 @@ auto VideoTrack::Shared::presentFrame(
 | 
				
			||||||
		const auto trackLeft = position - time.trackTime;
 | 
							const auto trackLeft = position - time.trackTime;
 | 
				
			||||||
		frame->display = time.worldTime
 | 
							frame->display = time.worldTime
 | 
				
			||||||
			+ crl::time(std::round(trackLeft / playbackSpeed));
 | 
								+ 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.
 | 
							// Release this frame to the main thread for rendering.
 | 
				
			||||||
		_counter.store(
 | 
							_counter.store(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue