hellner@google.com | 23a8065 | 2011-08-25 21:40:11 +0000 | [diff] [blame] | 1 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Niels Möller | d3da6b0 | 2020-03-05 15:31:10 +0100 | [diff] [blame] | 11 | #include "modules/video_coding/event_wrapper.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "rtc_base/event.h" |
Peter Boström | 64c0366 | 2015-04-08 11:24:19 +0200 | [diff] [blame] | 14 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 15 | namespace webrtc { |
Peter Boström | 64c0366 | 2015-04-08 11:24:19 +0200 | [diff] [blame] | 16 | |
| 17 | class EventWrapperImpl : public EventWrapper { |
| 18 | public: |
Peter Boström | 64c0366 | 2015-04-08 11:24:19 +0200 | [diff] [blame] | 19 | ~EventWrapperImpl() override {} |
| 20 | |
| 21 | bool Set() override { |
| 22 | event_.Set(); |
| 23 | return true; |
| 24 | } |
| 25 | |
Markus Handell | 2cfc1af | 2022-08-19 08:16:48 +0000 | [diff] [blame] | 26 | // TODO(bugs.webrtc.org/14366): Migrate to TimeDelta. |
Niels Möller | d3da6b0 | 2020-03-05 15:31:10 +0100 | [diff] [blame] | 27 | EventTypeWrapper Wait(int max_time_ms) override { |
Markus Handell | 2cfc1af | 2022-08-19 08:16:48 +0000 | [diff] [blame] | 28 | return event_.Wait(TimeDelta::Millis(max_time_ms)) ? kEventSignaled |
| 29 | : kEventTimeout; |
Peter Boström | 64c0366 | 2015-04-08 11:24:19 +0200 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | private: |
| 33 | rtc::Event event_; |
| 34 | }; |
| 35 | |
| 36 | // static |
phoglund@webrtc.org | 5bbe069 | 2012-12-10 10:44:37 +0000 | [diff] [blame] | 37 | EventWrapper* EventWrapper::Create() { |
Peter Boström | 64c0366 | 2015-04-08 11:24:19 +0200 | [diff] [blame] | 38 | return new EventWrapperImpl(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | } |
Peter Boström | 64c0366 | 2015-04-08 11:24:19 +0200 | [diff] [blame] | 40 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 41 | } // namespace webrtc |