OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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_API_TEST_FAKEVIDEOTRACKRENDERER_H_ | 11 #ifndef WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_ |
12 #define WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_ | 12 #define WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_ |
13 | 13 |
14 #include "webrtc/api/mediastreaminterface.h" | 14 #include "webrtc/api/mediastreaminterface.h" |
15 #include "webrtc/media/base/fakevideorenderer.h" | 15 #include "webrtc/media/base/fakevideorenderer.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 | 18 |
19 class FakeVideoTrackRenderer : public VideoRendererInterface { | 19 class FakeVideoTrackRenderer |
20 : public rtc::VideoSinkInterface<cricket::VideoFrame> { | |
perkj_webrtc
2016/02/12 14:40:14
Se should continue testing both until all clients
nisse-webrtc
2016/02/15 08:54:48
Unclear what you suggest...
I think it should be
perkj_webrtc
2016/02/15 12:36:27
Sorry- I meant that currently clients such as chro
nisse-webrtc
2016/02/15 14:51:53
Made two variants of the VideoTrack.RenderVideo te
| |
20 public: | 21 public: |
21 FakeVideoTrackRenderer(VideoTrackInterface* video_track) | 22 FakeVideoTrackRenderer(VideoTrackInterface* video_track) |
22 : video_track_(video_track), last_frame_(NULL) { | 23 : video_track_(video_track), last_frame_(NULL) { |
23 video_track_->AddRenderer(this); | 24 video_track_->AddOrUpdateSink(this, rtc::VideoSinkWants()); |
24 } | 25 } |
25 ~FakeVideoTrackRenderer() { | 26 ~FakeVideoTrackRenderer() { |
26 video_track_->RemoveRenderer(this); | 27 video_track_->RemoveSink(this); |
27 } | 28 } |
28 | 29 |
29 virtual void RenderFrame(const cricket::VideoFrame* video_frame) override { | 30 virtual void OnFrame(const cricket::VideoFrame& video_frame) override { |
30 last_frame_ = const_cast<cricket::VideoFrame*>(video_frame); | 31 last_frame_ = const_cast<cricket::VideoFrame*>(&video_frame); |
31 fake_renderer_.RenderFrame(video_frame); | 32 fake_renderer_.RenderFrame(&video_frame); |
32 } | 33 } |
33 | 34 |
34 int errors() const { return fake_renderer_.errors(); } | 35 int errors() const { return fake_renderer_.errors(); } |
35 int width() const { return fake_renderer_.width(); } | 36 int width() const { return fake_renderer_.width(); } |
36 int height() const { return fake_renderer_.height(); } | 37 int height() const { return fake_renderer_.height(); } |
37 bool black_frame() const { return fake_renderer_.black_frame(); } | 38 bool black_frame() const { return fake_renderer_.black_frame(); } |
38 | 39 |
39 int num_rendered_frames() const { | 40 int num_rendered_frames() const { |
40 return fake_renderer_.num_rendered_frames(); | 41 return fake_renderer_.num_rendered_frames(); |
41 } | 42 } |
42 const cricket::VideoFrame* last_frame() const { return last_frame_; } | 43 const cricket::VideoFrame* last_frame() const { return last_frame_; } |
43 | 44 |
44 private: | 45 private: |
45 cricket::FakeVideoRenderer fake_renderer_; | 46 cricket::FakeVideoRenderer fake_renderer_; |
46 rtc::scoped_refptr<VideoTrackInterface> video_track_; | 47 rtc::scoped_refptr<VideoTrackInterface> video_track_; |
47 | 48 |
48 // Weak reference for frame pointer comparison only. | 49 // Weak reference for frame pointer comparison only. |
49 cricket::VideoFrame* last_frame_; | 50 cricket::VideoFrame* last_frame_; |
50 }; | 51 }; |
51 | 52 |
52 } // namespace webrtc | 53 } // namespace webrtc |
53 | 54 |
54 #endif // WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_ | 55 #endif // WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_ |
OLD | NEW |