tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fake_video_renderer.h (1730B)


      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 #ifndef MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
     12 #define MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
     13 
     14 #include <stdint.h>
     15 
     16 #include "api/video/video_frame.h"
     17 #include "api/video/video_rotation.h"
     18 #include "api/video/video_sink_interface.h"
     19 #include "rtc_base/synchronization/mutex.h"
     20 
     21 namespace webrtc {
     22 
     23 // Faked video renderer that has a callback for actions on rendering.
     24 class FakeVideoRenderer : public VideoSinkInterface<VideoFrame> {
     25 public:
     26  FakeVideoRenderer();
     27 
     28  void OnFrame(const VideoFrame& frame) override;
     29 
     30  int width() const {
     31    MutexLock lock(&mutex_);
     32    return width_;
     33  }
     34  int height() const {
     35    MutexLock lock(&mutex_);
     36    return height_;
     37  }
     38 
     39  VideoRotation rotation() const {
     40    MutexLock lock(&mutex_);
     41    return rotation_;
     42  }
     43 
     44  int64_t timestamp_us() const {
     45    MutexLock lock(&mutex_);
     46    return timestamp_us_;
     47  }
     48 
     49  int num_rendered_frames() const {
     50    MutexLock lock(&mutex_);
     51    return num_rendered_frames_;
     52  }
     53 
     54  bool black_frame() const {
     55    MutexLock lock(&mutex_);
     56    return black_frame_;
     57  }
     58 
     59 private:
     60  int width_ = 0;
     61  int height_ = 0;
     62  VideoRotation rotation_ = kVideoRotation_0;
     63  int64_t timestamp_us_ = 0;
     64  int num_rendered_frames_ = 0;
     65  bool black_frame_ = false;
     66  mutable Mutex mutex_;
     67 };
     68 
     69 }  //  namespace webrtc
     70 
     71 
     72 #endif  // MEDIA_BASE_FAKE_VIDEO_RENDERER_H_