Android-cuttlefish cvd tool
recording_manager.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
20
21#include <condition_variable>
22#include <map>
23#include <memory>
24#include <mutex>
25#include <string>
26
27namespace webrtc {
28class VideoTrackSourceInterface;
29}
30
31namespace cuttlefish {
32namespace webrtc_streaming {
33
34class Source {
35public:
36 size_t width_;
37 size_t height_;
38 std::shared_ptr<::webrtc::VideoTrackSourceInterface> video_;
39};
40
42public:
44
45 void AddSource(size_t width, size_t height,
46 std::shared_ptr<::webrtc::VideoTrackSourceInterface> video,
47 const std::string& label);
48 void RemoveSource(const std::string& label);
49 void Start();
50 void Stop();
51 void WaitForSources(size_t num_sources);
52
53private:
56 std::string instance_name_;
57 std::mutex mutex_;
58 std::condition_variable video_source_ready_signal_;
59 std::map<std::string, std::unique_ptr<Source>> sources_;
60 std::map<std::string,
61 std::unique_ptr<cuttlefish::webrtc_streaming::LocalRecorder>> local_recorders_;
62
63 void StartSingleRecorder(const std::string& label);
64};
65
66} // namespace webrtc_streaming
67} // namespace cuttlefish
Definition: recording_manager.h:41
std::string instance_name_
Definition: recording_manager.h:56
std::string recording_directory_
Definition: recording_manager.h:55
void StartSingleRecorder(const std::string &label)
Definition: recording_manager.cpp:108
bool recording_
Definition: recording_manager.h:54
std::condition_variable video_source_ready_signal_
Definition: recording_manager.h:58
void Start()
Definition: recording_manager.cpp:73
void WaitForSources(size_t num_sources)
Definition: recording_manager.cpp:101
void AddSource(size_t width, size_t height, std::shared_ptr<::webrtc::VideoTrackSourceInterface > video, const std::string &label)
Definition: recording_manager.cpp:39
std::mutex mutex_
Definition: recording_manager.h:57
void RemoveSource(const std::string &label)
Definition: recording_manager.cpp:59
RecordingManager()
Definition: recording_manager.cpp:29
void Stop()
Definition: recording_manager.cpp:86
std::map< std::string, std::unique_ptr< cuttlefish::webrtc_streaming::LocalRecorder > > local_recorders_
Definition: recording_manager.h:61
std::map< std::string, std::unique_ptr< Source > > sources_
Definition: recording_manager.h:59
Definition: recording_manager.h:34
std::shared_ptr<::webrtc::VideoTrackSourceInterface > video_
Definition: recording_manager.h:38
size_t height_
Definition: recording_manager.h:37
size_t width_
Definition: recording_manager.h:36
Definition: alloc_utils.cpp:23
Definition: registered_field_trials.h:8