Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions media/server/gstplayer/source/GstGenericPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* limitations under the License.
*/

#include <atomic>
#include <chrono>
#include <cinttypes>
#include <cstring>
Expand Down Expand Up @@ -467,10 +468,23 @@ void GstGenericPlayer::setSourceFlushed(const MediaSourceType &mediaSourceType)

void GstGenericPlayer::notifyPlaybackInfo()
{
static std::atomic<int> notifyCount{0};
const int currentCount = ++notifyCount;
const auto start = std::chrono::steady_clock::now();
Comment on lines +471 to +473

PlaybackInfo info;
getPosition(info.currentPosition);
getVolume(info.volume);
m_gstPlayerClient->notifyPlaybackInfo(info);

const auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now() - start);

if ((currentCount % 1) == 0)
{
RIALTO_SERVER_LOG_INFO("notifyPlaybackInfo cycle %d took %lld us", currentCount,
static_cast<long long>(elapsed.count()));
}
Comment on lines +483 to +487
}

GstElement *GstGenericPlayer::getDecoder(const MediaSourceType &mediaSourceType)
Expand Down Expand Up @@ -2211,9 +2225,13 @@ void GstGenericPlayer::startNotifyPlaybackInfoTimer()
static constexpr std::chrono::milliseconds kPlaybackInfoTimerMs{32};
if (m_playbackInfoTimer && m_playbackInfoTimer->isActive())
{
RIALTO_SERVER_LOG_DEBUG("NotifyPlaybackInfoTimer already active, skipping start");
return;
}

RIALTO_SERVER_LOG_DEBUG("Starting NotifyPlaybackInfoTimer (interval %d ms)",
static_cast<int>(kPlaybackInfoTimerMs.count()));

notifyPlaybackInfo();

m_playbackInfoTimer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void HandleBusMessage::execute() const
}
case GST_STATE_PAUSED:
{
RIALTO_SERVER_LOG_DEBUG("PAUSED state: starting notify playback info timer");
m_player.startNotifyPlaybackInfoTimer();
m_player.stopPositionReportingAndCheckAudioUnderflowTimer();
if (pending != GST_STATE_PAUSED)
Expand Down
Loading