niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/video_coding/timing.h" |
stefan@webrtc.org | a678a3b | 2013-01-21 07:42:11 +0000 | [diff] [blame] | 12 | |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 13 | #include <algorithm> |
| 14 | |
Karl Wiberg | 76b7f51 | 2018-03-22 15:29:03 +0100 | [diff] [blame] | 15 | #include "rtc_base/time/timestamp_extrapolator.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "system_wrappers/include/clock.h" |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 17 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 18 | namespace webrtc { |
| 19 | |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 20 | VCMTiming::VCMTiming(Clock* clock, VCMTiming* master_timing) |
ilnik | 2edc684 | 2017-07-06 03:06:50 -0700 | [diff] [blame] | 21 | : clock_(clock), |
| 22 | master_(false), |
| 23 | ts_extrapolator_(), |
| 24 | codec_timer_(new VCMCodecTimer()), |
| 25 | render_delay_ms_(kDefaultRenderDelayMs), |
| 26 | min_playout_delay_ms_(0), |
| 27 | max_playout_delay_ms_(10000), |
| 28 | jitter_delay_ms_(0), |
| 29 | current_delay_ms_(0), |
| 30 | last_decode_ms_(0), |
| 31 | prev_frame_timestamp_(0), |
| 32 | timing_frame_info_(), |
Åsa Persson | 81327d5 | 2018-06-05 13:34:33 +0200 | [diff] [blame] | 33 | num_decoded_frames_(0) { |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 34 | if (master_timing == NULL) { |
| 35 | master_ = true; |
wu@webrtc.org | 66773a0 | 2014-05-07 17:09:44 +0000 | [diff] [blame] | 36 | ts_extrapolator_ = new TimestampExtrapolator(clock_->TimeInMilliseconds()); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 37 | } else { |
| 38 | ts_extrapolator_ = master_timing->ts_extrapolator_; |
| 39 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | } |
| 41 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 42 | VCMTiming::~VCMTiming() { |
| 43 | if (master_) { |
| 44 | delete ts_extrapolator_; |
| 45 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | } |
| 47 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 48 | void VCMTiming::Reset() { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 49 | rtc::CritScope cs(&crit_sect_); |
wu@webrtc.org | ed4cb56 | 2014-05-06 04:50:49 +0000 | [diff] [blame] | 50 | ts_extrapolator_->Reset(clock_->TimeInMilliseconds()); |
magjed | 2943f01 | 2016-03-22 05:12:09 -0700 | [diff] [blame] | 51 | codec_timer_.reset(new VCMCodecTimer()); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 52 | render_delay_ms_ = kDefaultRenderDelayMs; |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 53 | min_playout_delay_ms_ = 0; |
| 54 | jitter_delay_ms_ = 0; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 55 | current_delay_ms_ = 0; |
| 56 | prev_frame_timestamp_ = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 57 | } |
| 58 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 59 | void VCMTiming::set_render_delay(int render_delay_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 60 | rtc::CritScope cs(&crit_sect_); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 61 | render_delay_ms_ = render_delay_ms; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 62 | } |
| 63 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 64 | void VCMTiming::set_min_playout_delay(int min_playout_delay_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 65 | rtc::CritScope cs(&crit_sect_); |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 66 | min_playout_delay_ms_ = min_playout_delay_ms; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | } |
| 68 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 69 | int VCMTiming::min_playout_delay() { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 70 | rtc::CritScope cs(&crit_sect_); |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 71 | return min_playout_delay_ms_; |
| 72 | } |
| 73 | |
| 74 | void VCMTiming::set_max_playout_delay(int max_playout_delay_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 75 | rtc::CritScope cs(&crit_sect_); |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 76 | max_playout_delay_ms_ = max_playout_delay_ms; |
| 77 | } |
| 78 | |
| 79 | int VCMTiming::max_playout_delay() { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 80 | rtc::CritScope cs(&crit_sect_); |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 81 | return max_playout_delay_ms_; |
| 82 | } |
| 83 | |
| 84 | void VCMTiming::SetJitterDelay(int jitter_delay_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 85 | rtc::CritScope cs(&crit_sect_); |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 86 | if (jitter_delay_ms != jitter_delay_ms_) { |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 87 | jitter_delay_ms_ = jitter_delay_ms; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 88 | // When in initial state, set current delay to minimum delay. |
| 89 | if (current_delay_ms_ == 0) { |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 90 | current_delay_ms_ = jitter_delay_ms_; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 91 | } |
| 92 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 93 | } |
| 94 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 95 | void VCMTiming::UpdateCurrentDelay(uint32_t frame_timestamp) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 96 | rtc::CritScope cs(&crit_sect_); |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 97 | int target_delay_ms = TargetDelayInternal(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 98 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 99 | if (current_delay_ms_ == 0) { |
| 100 | // Not initialized, set current delay to target. |
| 101 | current_delay_ms_ = target_delay_ms; |
| 102 | } else if (target_delay_ms != current_delay_ms_) { |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 103 | int64_t delay_diff_ms = |
| 104 | static_cast<int64_t>(target_delay_ms) - current_delay_ms_; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 105 | // Never change the delay with more than 100 ms every second. If we're |
| 106 | // changing the delay in too large steps we will get noticeable freezes. By |
| 107 | // limiting the change we can increase the delay in smaller steps, which |
| 108 | // will be experienced as the video is played in slow motion. When lowering |
| 109 | // the delay the video will be played at a faster pace. |
| 110 | int64_t max_change_ms = 0; |
| 111 | if (frame_timestamp < 0x0000ffff && prev_frame_timestamp_ > 0xffff0000) { |
| 112 | // wrap |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 113 | max_change_ms = kDelayMaxChangeMsPerS * |
| 114 | (frame_timestamp + (static_cast<int64_t>(1) << 32) - |
| 115 | prev_frame_timestamp_) / |
| 116 | 90000; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 117 | } else { |
| 118 | max_change_ms = kDelayMaxChangeMsPerS * |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 119 | (frame_timestamp - prev_frame_timestamp_) / 90000; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 120 | } |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 121 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 122 | if (max_change_ms <= 0) { |
Åsa Persson | 8368d1a | 2018-01-05 12:44:45 +0100 | [diff] [blame] | 123 | // Any changes less than 1 ms are truncated and will be postponed. |
| 124 | // Negative change will be due to reordering and should be ignored. |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 125 | return; |
| 126 | } |
| 127 | delay_diff_ms = std::max(delay_diff_ms, -max_change_ms); |
| 128 | delay_diff_ms = std::min(delay_diff_ms, max_change_ms); |
mikhal@webrtc.org | 6faba6e | 2013-04-30 15:39:34 +0000 | [diff] [blame] | 129 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 130 | current_delay_ms_ = current_delay_ms_ + delay_diff_ms; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 131 | } |
| 132 | prev_frame_timestamp_ = frame_timestamp; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 133 | } |
| 134 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 135 | void VCMTiming::UpdateCurrentDelay(int64_t render_time_ms, |
| 136 | int64_t actual_decode_time_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 137 | rtc::CritScope cs(&crit_sect_); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 138 | uint32_t target_delay_ms = TargetDelayInternal(); |
magjed | 2943f01 | 2016-03-22 05:12:09 -0700 | [diff] [blame] | 139 | int64_t delayed_ms = |
| 140 | actual_decode_time_ms - |
| 141 | (render_time_ms - RequiredDecodeTimeMs() - render_delay_ms_); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 142 | if (delayed_ms < 0) { |
| 143 | return; |
| 144 | } |
| 145 | if (current_delay_ms_ + delayed_ms <= target_delay_ms) { |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 146 | current_delay_ms_ += delayed_ms; |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 147 | } else { |
| 148 | current_delay_ms_ = target_delay_ms; |
| 149 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 150 | } |
| 151 | |
Åsa Persson | 8368d1a | 2018-01-05 12:44:45 +0100 | [diff] [blame] | 152 | void VCMTiming::StopDecodeTimer(uint32_t time_stamp, |
| 153 | int32_t decode_time_ms, |
| 154 | int64_t now_ms, |
| 155 | int64_t render_time_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 156 | rtc::CritScope cs(&crit_sect_); |
magjed | 2943f01 | 2016-03-22 05:12:09 -0700 | [diff] [blame] | 157 | codec_timer_->AddTiming(decode_time_ms, now_ms); |
Per | 327d8ba | 2015-11-10 14:00:27 +0100 | [diff] [blame] | 158 | assert(decode_time_ms >= 0); |
| 159 | last_decode_ms_ = decode_time_ms; |
asapersson@webrtc.org | f244760 | 2014-12-09 14:13:26 +0000 | [diff] [blame] | 160 | ++num_decoded_frames_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 161 | } |
| 162 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 163 | void VCMTiming::IncomingTimestamp(uint32_t time_stamp, int64_t now_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 164 | rtc::CritScope cs(&crit_sect_); |
stefan@webrtc.org | 34c5da6 | 2014-04-11 14:08:35 +0000 | [diff] [blame] | 165 | ts_extrapolator_->Update(now_ms, time_stamp); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 166 | } |
| 167 | |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 168 | int64_t VCMTiming::RenderTimeMs(uint32_t frame_timestamp, |
| 169 | int64_t now_ms) const { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 170 | rtc::CritScope cs(&crit_sect_); |
Stefan Holmer | 812ceaf | 2018-05-15 13:00:10 +0200 | [diff] [blame] | 171 | return RenderTimeMsInternal(frame_timestamp, now_ms); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 172 | } |
| 173 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 174 | int64_t VCMTiming::RenderTimeMsInternal(uint32_t frame_timestamp, |
| 175 | int64_t now_ms) const { |
Stefan Holmer | 812ceaf | 2018-05-15 13:00:10 +0200 | [diff] [blame] | 176 | if (min_playout_delay_ms_ == 0 && max_playout_delay_ms_ == 0) { |
| 177 | // Render as soon as possible. |
| 178 | return 0; |
| 179 | } |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 180 | int64_t estimated_complete_time_ms = |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 181 | ts_extrapolator_->ExtrapolateLocalTime(frame_timestamp); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 182 | if (estimated_complete_time_ms == -1) { |
| 183 | estimated_complete_time_ms = now_ms; |
| 184 | } |
mikhal@webrtc.org | 6faba6e | 2013-04-30 15:39:34 +0000 | [diff] [blame] | 185 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 186 | // Make sure the actual delay stays in the range of |min_playout_delay_ms_| |
| 187 | // and |max_playout_delay_ms_|. |
| 188 | int actual_delay = std::max(current_delay_ms_, min_playout_delay_ms_); |
| 189 | actual_delay = std::min(actual_delay, max_playout_delay_ms_); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 190 | return estimated_complete_time_ms + actual_delay; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 191 | } |
| 192 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 193 | int VCMTiming::RequiredDecodeTimeMs() const { |
| 194 | const int decode_time_ms = codec_timer_->RequiredDecodeTimeMs(); |
stefan@webrtc.org | 34c5da6 | 2014-04-11 14:08:35 +0000 | [diff] [blame] | 195 | assert(decode_time_ms >= 0); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 196 | return decode_time_ms; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 197 | } |
| 198 | |
Ilya Nikolaevskiy | 8c4fe16 | 2018-02-27 15:49:47 +0100 | [diff] [blame] | 199 | int64_t VCMTiming::MaxWaitingTime(int64_t render_time_ms, |
| 200 | int64_t now_ms) const { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 201 | rtc::CritScope cs(&crit_sect_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 202 | |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 203 | const int64_t max_wait_time_ms = |
magjed | 2943f01 | 2016-03-22 05:12:09 -0700 | [diff] [blame] | 204 | render_time_ms - now_ms - RequiredDecodeTimeMs() - render_delay_ms_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 205 | |
Ilya Nikolaevskiy | 8c4fe16 | 2018-02-27 15:49:47 +0100 | [diff] [blame] | 206 | return max_wait_time_ms; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 207 | } |
| 208 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 209 | int VCMTiming::TargetVideoDelay() const { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 210 | rtc::CritScope cs(&crit_sect_); |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 211 | return TargetDelayInternal(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 212 | } |
| 213 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 214 | int VCMTiming::TargetDelayInternal() const { |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 215 | return std::max(min_playout_delay_ms_, |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 216 | jitter_delay_ms_ + RequiredDecodeTimeMs() + render_delay_ms_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 217 | } |
| 218 | |
asapersson | 8d56088 | 2016-12-22 01:26:18 -0800 | [diff] [blame] | 219 | bool VCMTiming::GetTimings(int* decode_ms, |
fischman@webrtc.org | 37bb497 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 220 | int* max_decode_ms, |
| 221 | int* current_delay_ms, |
| 222 | int* target_delay_ms, |
| 223 | int* jitter_buffer_ms, |
| 224 | int* min_playout_delay_ms, |
| 225 | int* render_delay_ms) const { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 226 | rtc::CritScope cs(&crit_sect_); |
fischman@webrtc.org | 37bb497 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 227 | *decode_ms = last_decode_ms_; |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 228 | *max_decode_ms = RequiredDecodeTimeMs(); |
fischman@webrtc.org | 37bb497 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 229 | *current_delay_ms = current_delay_ms_; |
| 230 | *target_delay_ms = TargetDelayInternal(); |
| 231 | *jitter_buffer_ms = jitter_delay_ms_; |
| 232 | *min_playout_delay_ms = min_playout_delay_ms_; |
| 233 | *render_delay_ms = render_delay_ms_; |
asapersson | 8d56088 | 2016-12-22 01:26:18 -0800 | [diff] [blame] | 234 | return (num_decoded_frames_ > 0); |
fischman@webrtc.org | 37bb497 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 235 | } |
| 236 | |
ilnik | 2edc684 | 2017-07-06 03:06:50 -0700 | [diff] [blame] | 237 | void VCMTiming::SetTimingFrameInfo(const TimingFrameInfo& info) { |
| 238 | rtc::CritScope cs(&crit_sect_); |
| 239 | timing_frame_info_.emplace(info); |
| 240 | } |
| 241 | |
| 242 | rtc::Optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() { |
| 243 | rtc::CritScope cs(&crit_sect_); |
| 244 | return timing_frame_info_; |
| 245 | } |
| 246 | |
mikhal@webrtc.org | 2eaf98b | 2013-05-21 17:58:43 +0000 | [diff] [blame] | 247 | } // namespace webrtc |