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

Side by Side Diff: talk/app/webrtc/test/fakevideotrackrenderer.h

Issue 1313753003: Remove VideoRendererInterface::CanApplyRotation() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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
« no previous file with comments | « talk/app/webrtc/mediastreaminterface.h ('k') | talk/app/webrtc/videotrack_unittest.cc » ('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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 18 matching lines...) Expand all
29 #define TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_ 29 #define TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_
30 30
31 #include "talk/app/webrtc/mediastreaminterface.h" 31 #include "talk/app/webrtc/mediastreaminterface.h"
32 #include "talk/media/base/fakevideorenderer.h" 32 #include "talk/media/base/fakevideorenderer.h"
33 33
34 namespace webrtc { 34 namespace webrtc {
35 35
36 class FakeVideoTrackRenderer : public VideoRendererInterface { 36 class FakeVideoTrackRenderer : public VideoRendererInterface {
37 public: 37 public:
38 FakeVideoTrackRenderer(VideoTrackInterface* video_track) 38 FakeVideoTrackRenderer(VideoTrackInterface* video_track)
39 : video_track_(video_track), 39 : video_track_(video_track), last_frame_(NULL) {
40 can_apply_rotation_(true),
41 last_frame_(NULL) {
42 video_track_->AddRenderer(this);
43 }
44 FakeVideoTrackRenderer(VideoTrackInterface* video_track,
45 bool can_apply_rotation)
46 : video_track_(video_track),
47 can_apply_rotation_(can_apply_rotation),
48 last_frame_(NULL) {
49 video_track_->AddRenderer(this); 40 video_track_->AddRenderer(this);
50 } 41 }
51 ~FakeVideoTrackRenderer() { 42 ~FakeVideoTrackRenderer() {
52 video_track_->RemoveRenderer(this); 43 video_track_->RemoveRenderer(this);
53 } 44 }
54 45
55 virtual void RenderFrame(const cricket::VideoFrame* video_frame) override { 46 virtual void RenderFrame(const cricket::VideoFrame* video_frame) override {
56 last_frame_ = const_cast<cricket::VideoFrame*>(video_frame); 47 last_frame_ = const_cast<cricket::VideoFrame*>(video_frame);
57 48 if (!fake_renderer_.SetSize(static_cast<int>(video_frame->GetWidth()),
58 const cricket::VideoFrame* frame = 49 static_cast<int>(video_frame->GetHeight()),
59 can_apply_rotation_ ? video_frame 50 0)) {
60 : video_frame->GetCopyWithRotationApplied();
61
62 if (!fake_renderer_.SetSize(static_cast<int>(frame->GetWidth()),
63 static_cast<int>(frame->GetHeight()), 0)) {
64 return; 51 return;
65 } 52 }
66 53
67 fake_renderer_.RenderFrame(frame); 54 fake_renderer_.RenderFrame(video_frame);
68 } 55 }
69 56
70 virtual bool CanApplyRotation() override { return can_apply_rotation_; }
71
72 int errors() const { return fake_renderer_.errors(); } 57 int errors() const { return fake_renderer_.errors(); }
73 int width() const { return fake_renderer_.width(); } 58 int width() const { return fake_renderer_.width(); }
74 int height() const { return fake_renderer_.height(); } 59 int height() const { return fake_renderer_.height(); }
75 int num_rendered_frames() const { 60 int num_rendered_frames() const {
76 return fake_renderer_.num_rendered_frames(); 61 return fake_renderer_.num_rendered_frames();
77 } 62 }
78 const cricket::VideoFrame* last_frame() const { return last_frame_; } 63 const cricket::VideoFrame* last_frame() const { return last_frame_; }
79 64
80 private: 65 private:
81 cricket::FakeVideoRenderer fake_renderer_; 66 cricket::FakeVideoRenderer fake_renderer_;
82 rtc::scoped_refptr<VideoTrackInterface> video_track_; 67 rtc::scoped_refptr<VideoTrackInterface> video_track_;
83 bool can_apply_rotation_;
84 68
85 // Weak reference for frame pointer comparison only. 69 // Weak reference for frame pointer comparison only.
86 cricket::VideoFrame* last_frame_; 70 cricket::VideoFrame* last_frame_;
87 }; 71 };
88 72
89 } // namespace webrtc 73 } // namespace webrtc
90 74
91 #endif // TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_ 75 #endif // TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/mediastreaminterface.h ('k') | talk/app/webrtc/videotrack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698