chromium/third_party/blink/common/media/watch_time_reporter.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/public/common/media/watch_time_reporter.h"

#include <numeric>
#include <vector>

#include "base/functional/bind.h"
#include "base/power_monitor/power_monitor.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "media/base/pipeline_status.h"
#include "media/base/timestamp_constants.h"
#include "media/base/watch_time_keys.h"

namespace blink {

// The minimum width and height of videos to report watch time metrics for.
constexpr gfx::Size kMinimumVideoSize =;

static bool IsOnBatteryPower() {}

// Helper function for managing property changes. If the watch time timer is
// running it sets the pending value otherwise it sets the current value and
// then returns true if the component needs finalize.
enum class PropertyAction {};
template <typename T>
PropertyAction HandlePropertyChange(T new_value,
                                    bool is_timer_running,
                                    WatchTimeComponent<T>* component) {}

WatchTimeReporter::WatchTimeReporter(
    media::mojom::PlaybackPropertiesPtr properties,
    const gfx::Size& natural_size,
    GetMediaTimeCB get_media_time_cb,
    GetPipelineStatsCB get_pipeline_stats_cb,
    media::mojom::MediaMetricsProvider* provider,
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    const base::TickClock* tick_clock)
    :{}

WatchTimeReporter::WatchTimeReporter(
    media::mojom::PlaybackPropertiesPtr properties,
    bool is_background,
    bool is_muted,
    const gfx::Size& natural_size,
    GetMediaTimeCB get_media_time_cb,
    GetPipelineStatsCB get_pipeline_stats_cb,
    media::mojom::MediaMetricsProvider* provider,
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    const base::TickClock* tick_clock)
    :{}

WatchTimeReporter::~WatchTimeReporter() {}

void WatchTimeReporter::OnPlaying() {}

void WatchTimeReporter::OnPaused() {}

void WatchTimeReporter::OnSeeking() {}

void WatchTimeReporter::OnVolumeChange(double volume) {}

void WatchTimeReporter::OnShown() {}

void WatchTimeReporter::OnHidden() {}

void WatchTimeReporter::OnError(media::PipelineStatus status) {}

void WatchTimeReporter::OnUnderflow() {}

void WatchTimeReporter::OnUnderflowComplete(base::TimeDelta elapsed) {}

void WatchTimeReporter::OnNativeControlsEnabled() {}

void WatchTimeReporter::OnNativeControlsDisabled() {}

void WatchTimeReporter::OnDisplayTypeInline() {}

void WatchTimeReporter::OnDisplayTypeFullscreen() {}

void WatchTimeReporter::OnDisplayTypePictureInPicture() {}

void WatchTimeReporter::UpdateSecondaryProperties(
    media::mojom::SecondaryPlaybackPropertiesPtr secondary_properties) {}

void WatchTimeReporter::SetAutoplayInitiated(bool autoplay_initiated) {}

void WatchTimeReporter::OnDurationChanged(base::TimeDelta duration) {}

void WatchTimeReporter::OnPowerStateChange(bool on_battery_power) {}

void WatchTimeReporter::OnNativeControlsChanged(bool has_native_controls) {}

void WatchTimeReporter::OnDisplayTypeChanged(DisplayType display_type) {}

bool WatchTimeReporter::ShouldReportWatchTime() const {}

bool WatchTimeReporter::ShouldReportingTimerRun() const {}

void WatchTimeReporter::MaybeStartReportingTimer(
    base::TimeDelta start_timestamp) {}

void WatchTimeReporter::MaybeFinalizeWatchTime(FinalizeTime finalize_time) {}

void WatchTimeReporter::RestartTimerForHysteresis() {}

void WatchTimeReporter::RecordWatchTime() {}

void WatchTimeReporter::UpdateWatchTime() {}

void WatchTimeReporter::ResetUnderflowState() {}

#define NORMAL_KEY

std::unique_ptr<WatchTimeComponent<bool>>
WatchTimeReporter::CreateBaseComponent() {}

std::unique_ptr<WatchTimeComponent<bool>>
WatchTimeReporter::CreatePowerComponent() {}

media::WatchTimeKey WatchTimeReporter::GetPowerKey(bool is_on_battery_power) {}
#undef NORMAL_KEY

#define FOREGROUND_KEY

std::unique_ptr<WatchTimeComponent<bool>>
WatchTimeReporter::CreateControlsComponent() {}

media::WatchTimeKey WatchTimeReporter::GetControlsKey(
    bool has_native_controls) {}

#undef FOREGROUND_KEY

#define DISPLAY_TYPE_KEY

std::unique_ptr<WatchTimeComponent<DisplayType>>
WatchTimeReporter::CreateDisplayTypeComponent() {}

media::WatchTimeKey WatchTimeReporter::GetDisplayTypeKey(
    DisplayType display_type) {}

#undef DISPLAY_TYPE_KEY

}  // namespace blink