// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_MOJO_SERVICES_WEBRTC_VIDEO_PERF_HISTORY_H_ #define MEDIA_MOJO_SERVICES_WEBRTC_VIDEO_PERF_HISTORY_H_ #include <stdint.h> #include <memory> #include <queue> #include "base/functional/callback.h" #include "base/metrics/field_trial_params.h" #include "base/sequence_checker.h" #include "base/supports_user_data.h" #include "media/base/video_codecs.h" #include "media/capabilities/webrtc_video_stats_db.h" #include "media/capabilities/webrtc_video_stats_db_provider.h" #include "media/mojo/mojom/webrtc_video_perf.mojom.h" #include "media/mojo/services/media_mojo_export.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" namespace media { // This class saves and retrieves WebRTC video performance statistics on behalf // of the MediaCapabilities API. // // The database is lazily initialized/loaded upon the first API call requiring // DB access. DB implementations must take care to perform work on a separate // task runner. // // Retrieving stats is triggered by calls to the GetPerfInfo() Mojo interface. // The raw values are reduced to a boolean (is_smooth) which is sent along the // Mojo callback. // // Saving stats is performed by SavePerfRecord(), where a record is defined as a // continuous playback/encoding of a stream with fixed characteristics (codec // profile, number of pixels, hardware accelerated). // // THREAD SAFETY: // This class is not thread safe. All API calls should be made on the same // sequence. class MEDIA_MOJO_EXPORT WebrtcVideoPerfHistory : public media::mojom::WebrtcVideoPerfHistory, public WebrtcVideoStatsDBProvider, public base::SupportsUserData::Data { … }; } // namespace media #endif // MEDIA_MOJO_SERVICES_WEBRTC_VIDEO_PERF_HISTORY_H_