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

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

Issue 2383093002: Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (Closed)
Patch Set: objc: Add missing include of video_frame_buffer.h. Created 4 years, 1 month 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
« no previous file with comments | « webrtc/media/base/fakevideocapturer.h ('k') | webrtc/media/base/mediachannel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/media/base/videoframe.h"
16 #include "webrtc/media/base/videosinkinterface.h" 15 #include "webrtc/media/base/videosinkinterface.h"
16 #include "webrtc/video_frame.h"
17 17
18 namespace cricket { 18 namespace cricket {
19 19
20 // Faked video renderer that has a callback for actions on rendering. 20 // Faked video renderer that has a callback for actions on rendering.
21 class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> { 21 class FakeVideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
22 public: 22 public:
23 FakeVideoRenderer() 23 FakeVideoRenderer()
24 : errors_(0), 24 : errors_(0),
25 width_(0), 25 width_(0),
26 height_(0), 26 height_(0),
27 rotation_(webrtc::kVideoRotation_0), 27 rotation_(webrtc::kVideoRotation_0),
28 timestamp_us_(0), 28 timestamp_us_(0),
29 num_rendered_frames_(0), 29 num_rendered_frames_(0),
30 black_frame_(false) {} 30 black_frame_(false) {}
31 31
32 virtual void OnFrame(const VideoFrame& frame) { 32 virtual void OnFrame(const webrtc::VideoFrame& frame) {
33 rtc::CritScope cs(&crit_); 33 rtc::CritScope cs(&crit_);
34 // TODO(zhurunz) Check with VP8 team to see if we can remove this 34 // TODO(zhurunz) Check with VP8 team to see if we can remove this
35 // tolerance on Y values. Some unit tests produce Y values close 35 // tolerance on Y values. Some unit tests produce Y values close
36 // to 16 rather than close to zero, for supposedly black frames. 36 // to 16 rather than close to zero, for supposedly black frames.
37 // Largest value observed is 34, e.g., running 37 // Largest value observed is 34, e.g., running
38 // P2PTestConductor.LocalP2PTest16To9 (peerconnection_unittests). 38 // P2PTestConductor.LocalP2PTest16To9 (peerconnection_unittests).
39 black_frame_ = CheckFrameColorYuv(0, 48, 128, 128, 128, 128, &frame); 39 black_frame_ = CheckFrameColorYuv(0, 48, 128, 128, 128, 128, &frame);
40 // Treat unexpected frame size as error. 40 // Treat unexpected frame size as error.
41 ++num_rendered_frames_; 41 ++num_rendered_frames_;
42 width_ = frame.width(); 42 width_ = frame.width();
(...skipping 29 matching lines...) Expand all
72 return black_frame_; 72 return black_frame_;
73 } 73 }
74 74
75 private: 75 private:
76 static bool CheckFrameColorYuv(uint8_t y_min, 76 static bool CheckFrameColorYuv(uint8_t y_min,
77 uint8_t y_max, 77 uint8_t y_max,
78 uint8_t u_min, 78 uint8_t u_min,
79 uint8_t u_max, 79 uint8_t u_max,
80 uint8_t v_min, 80 uint8_t v_min,
81 uint8_t v_max, 81 uint8_t v_max,
82 const cricket::VideoFrame* frame) { 82 const webrtc::VideoFrame* frame) {
83 if (!frame || !frame->video_frame_buffer()) { 83 if (!frame || !frame->video_frame_buffer()) {
84 return false; 84 return false;
85 } 85 }
86 // Y 86 // Y
87 int y_width = frame->width(); 87 int y_width = frame->width();
88 int y_height = frame->height(); 88 int y_height = frame->height();
89 const uint8_t* y_plane = frame->video_frame_buffer()->DataY(); 89 const uint8_t* y_plane = frame->video_frame_buffer()->DataY();
90 const uint8_t* y_pos = y_plane; 90 const uint8_t* y_pos = y_plane;
91 int32_t y_pitch = frame->video_frame_buffer()->StrideY(); 91 int32_t y_pitch = frame->video_frame_buffer()->StrideY();
92 for (int i = 0; i < y_height; ++i) { 92 for (int i = 0; i < y_height; ++i) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 webrtc::VideoRotation rotation_; 130 webrtc::VideoRotation rotation_;
131 int64_t timestamp_us_; 131 int64_t timestamp_us_;
132 int num_rendered_frames_; 132 int num_rendered_frames_;
133 bool black_frame_; 133 bool black_frame_;
134 rtc::CriticalSection crit_; 134 rtc::CriticalSection crit_;
135 }; 135 };
136 136
137 } // namespace cricket 137 } // namespace cricket
138 138
139 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_ 139 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEORENDERER_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/fakevideocapturer.h ('k') | webrtc/media/base/mediachannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698