Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: webrtc/media/base/fakevideorenderer.h

Issue 2305623002: Delete cricket::VideoFrame::GetTimeStamp. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_ 11 #ifndef WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_
12 #define WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_ 12 #define WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_
13 13
14 #include "webrtc/base/logging.h" 14 #include "webrtc/base/logging.h"
15 #include "webrtc/base/sigslot.h" 15 #include "webrtc/base/sigslot.h"
16 #include "webrtc/media/base/videoframe.h" 16 #include "webrtc/media/base/videoframe.h"
17 #include "webrtc/media/base/videosinkinterface.h" 17 #include "webrtc/media/base/videosinkinterface.h"
18 18
19 namespace cricket { 19 namespace cricket {
20 20
21 // Faked video renderer that has a callback for actions on rendering. 21 // Faked video renderer that has a callback for actions on rendering.
22 class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> { 22 class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
23 public: 23 public:
24 FakeVideoRenderer() 24 FakeVideoRenderer()
25 : errors_(0), 25 : errors_(0),
26 width_(0), 26 width_(0),
27 height_(0), 27 height_(0),
28 rotation_(webrtc::kVideoRotation_0), 28 rotation_(webrtc::kVideoRotation_0),
29 timestamp_(0), 29 timestamp_us_(0),
30 num_rendered_frames_(0), 30 num_rendered_frames_(0),
31 black_frame_(false) {} 31 black_frame_(false) {}
32 32
33 virtual void OnFrame(const VideoFrame& frame) { 33 virtual void OnFrame(const VideoFrame& frame) {
34 rtc::CritScope cs(&crit_); 34 rtc::CritScope cs(&crit_);
35 // TODO(zhurunz) Check with VP8 team to see if we can remove this 35 // TODO(zhurunz) Check with VP8 team to see if we can remove this
36 // tolerance on Y values. Some unit tests produce Y values close 36 // tolerance on Y values. Some unit tests produce Y values close
37 // to 16 rather than close to zero, for supposedly black frames. 37 // to 16 rather than close to zero, for supposedly black frames.
38 // Largest value observed is 34, e.g., running 38 // Largest value observed is 34, e.g., running
39 // P2PTestConductor.LocalP2PTest16To9 (peerconnection_unittests). 39 // P2PTestConductor.LocalP2PTest16To9 (peerconnection_unittests).
40 black_frame_ = CheckFrameColorYuv(0, 48, 128, 128, 128, 128, &frame); 40 black_frame_ = CheckFrameColorYuv(0, 48, 128, 128, 128, 128, &frame);
41 // Treat unexpected frame size as error. 41 // Treat unexpected frame size as error.
42 ++num_rendered_frames_; 42 ++num_rendered_frames_;
43 width_ = frame.width(); 43 width_ = frame.width();
44 height_ = frame.height(); 44 height_ = frame.height();
45 rotation_ = frame.rotation(); 45 rotation_ = frame.rotation();
46 timestamp_ = frame.GetTimeStamp(); 46 timestamp_us_ = frame.timestamp_us();
47 SignalRenderFrame(&frame); 47 SignalRenderFrame(&frame);
48 } 48 }
49 49
50 int errors() const { return errors_; } 50 int errors() const { return errors_; }
51 int width() const { 51 int width() const {
52 rtc::CritScope cs(&crit_); 52 rtc::CritScope cs(&crit_);
53 return width_; 53 return width_;
54 } 54 }
55 int height() const { 55 int height() const {
56 rtc::CritScope cs(&crit_); 56 rtc::CritScope cs(&crit_);
57 return height_; 57 return height_;
58 } 58 }
59 webrtc::VideoRotation rotation() const { 59 webrtc::VideoRotation rotation() const {
60 rtc::CritScope cs(&crit_); 60 rtc::CritScope cs(&crit_);
61 return rotation_; 61 return rotation_;
62 } 62 }
63 63
64 int64_t timestamp() const { 64 int64_t timestamp_us() const {
65 rtc::CritScope cs(&crit_); 65 rtc::CritScope cs(&crit_);
66 return timestamp_; 66 return timestamp_us_;
67 } 67 }
68 int num_rendered_frames() const { 68 int num_rendered_frames() const {
69 rtc::CritScope cs(&crit_); 69 rtc::CritScope cs(&crit_);
70 return num_rendered_frames_; 70 return num_rendered_frames_;
71 } 71 }
72 bool black_frame() const { 72 bool black_frame() const {
73 rtc::CritScope cs(&crit_); 73 rtc::CritScope cs(&crit_);
74 return black_frame_; 74 return black_frame_;
75 } 75 }
76 76
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 u_pos += u_pitch; 126 u_pos += u_pitch;
127 v_pos += v_pitch; 127 v_pos += v_pitch;
128 } 128 }
129 return true; 129 return true;
130 } 130 }
131 131
132 int errors_; 132 int errors_;
133 int width_; 133 int width_;
134 int height_; 134 int height_;
135 webrtc::VideoRotation rotation_; 135 webrtc::VideoRotation rotation_;
136 int64_t timestamp_; 136 int64_t timestamp_us_;
137 int num_rendered_frames_; 137 int num_rendered_frames_;
138 bool black_frame_; 138 bool black_frame_;
139 rtc::CriticalSection crit_; 139 rtc::CriticalSection crit_;
140 }; 140 };
141 141
142 } // namespace cricket 142 } // namespace cricket
143 143
144 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_ 144 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698