1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
media / mojo / mojom / video_encoder_info_mojom_traits.cc [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/mojo/mojom/video_encoder_info_mojom_traits.h"
#include "media/mojo/mojom/video_encoder_info.mojom.h"
namespace mojo {
// static
bool StructTraits<media::mojom::ResolutionRateLimitDataView,
media::ResolutionRateLimit>::
Read(media::mojom::ResolutionRateLimitDataView data,
media::ResolutionRateLimit* out) {
if (!data.ReadFrameSize(&out->frame_size))
return false;
out->min_start_bitrate_bps = data.min_start_bitrate_bps();
out->min_bitrate_bps = data.min_bitrate_bps();
out->max_bitrate_bps = data.max_bitrate_bps();
out->max_framerate_numerator = data.max_framerate_numerator();
out->max_framerate_denominator = data.max_framerate_denominator();
return true;
}
// static
bool StructTraits<
media::mojom::VideoEncoderInfoDataView,
media::VideoEncoderInfo>::Read(media::mojom::VideoEncoderInfoDataView data,
media::VideoEncoderInfo* out) {
out->supports_native_handle = data.supports_native_handle();
out->has_trusted_rate_controller = data.has_trusted_rate_controller();
out->is_hardware_accelerated = data.is_hardware_accelerated();
out->supports_simulcast = data.supports_simulcast();
out->reports_average_qp = data.reports_average_qp();
out->apply_alignment_to_all_simulcast_layers =
data.apply_alignment_to_all_simulcast_layers();
out->requested_resolution_alignment = data.requested_resolution_alignment();
out->supports_frame_size_change = data.supports_frame_size_change();
if (!data.ReadImplementationName(&out->implementation_name))
return false;
if (data.has_frame_delay())
out->frame_delay = data.frame_delay();
else
out->frame_delay.reset();
if (data.has_input_capacity())
out->input_capacity = data.input_capacity();
else
out->input_capacity.reset();
base::span<std::vector<uint8_t>> fps_allocation(out->fps_allocation);
if (!data.ReadFpsAllocation(&fps_allocation))
return false;
if (!data.ReadResolutionRateLimits(&out->resolution_rate_limits)) {
return false;
}
return true;
}
} // namespace mojo