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
19#include <condition_variable>
20#include <map>
21#include <memory>
22#include <mutex>
23#include <string>
24
26
27namespace webrtc {
28class VideoTrackSourceInterface;
29}
30
31namespace cuttlefish {
32namespace webrtc_streaming {
33
34class Source {
35 public:
36 size_t width_;
37 size_t height_;
38 std::shared_ptr<::webrtc::VideoTrackSourceInterface> video_;
39};
40
42 public:
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
53 private:
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>>
63
64 void StartSingleRecorder(const std::string& label);
65};
66
67} // namespace webrtc_streaming
68} // 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:109
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:74
void WaitForSources(size_t num_sources)
Definition: recording_manager.cpp:102
void AddSource(size_t width, size_t height, std::shared_ptr<::webrtc::VideoTrackSourceInterface > video, const std::string &label)
Definition: recording_manager.cpp:40
std::mutex mutex_
Definition: recording_manager.h:57
void RemoveSource(const std::string &label)
Definition: recording_manager.cpp:60
RecordingManager()
Definition: recording_manager.cpp:30
void Stop()
Definition: recording_manager.cpp:87
std::map< std::string, std::unique_ptr< cuttlefish::webrtc_streaming::LocalRecorder > > local_recorders_
Definition: recording_manager.h:62
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_driver.h:20
Definition: registered_field_trials.h:8