event_wrapper.cc (1107B)
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 11 #include "modules/video_coding/deprecated/event_wrapper.h" 12 13 #include "api/units/time_delta.h" 14 #include "rtc_base/event.h" 15 16 namespace webrtc { 17 18 class EventWrapperImpl : public EventWrapper { 19 public: 20 ~EventWrapperImpl() override {} 21 22 bool Set() override { 23 event_.Set(); 24 return true; 25 } 26 27 // TODO(bugs.webrtc.org/14366): Migrate to TimeDelta. 28 EventTypeWrapper Wait(int max_time_ms) override { 29 return event_.Wait(TimeDelta::Millis(max_time_ms)) ? kEventSignaled 30 : kEventTimeout; 31 } 32 33 private: 34 Event event_; 35 }; 36 37 // static 38 EventWrapper* EventWrapper::Create() { 39 return new EventWrapperImpl(); 40 } 41 42 } // namespace webrtc