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

Side by Side Diff: talk/app/webrtc/videotrackrenderers.cc

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/videotrackrenderers.h ('k') | no next file » | 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 23 matching lines...) Expand all
34 } 34 }
35 35
36 VideoTrackRenderers::~VideoTrackRenderers() { 36 VideoTrackRenderers::~VideoTrackRenderers() {
37 } 37 }
38 38
39 void VideoTrackRenderers::AddRenderer(VideoRendererInterface* renderer) { 39 void VideoTrackRenderers::AddRenderer(VideoRendererInterface* renderer) {
40 if (!renderer) { 40 if (!renderer) {
41 return; 41 return;
42 } 42 }
43 rtc::CritScope cs(&critical_section_); 43 rtc::CritScope cs(&critical_section_);
44 std::vector<RenderObserver>::iterator it = renderers_.begin(); 44 renderers_.insert(renderer);
45 for (; it != renderers_.end(); ++it) {
46 if (it->renderer_ == renderer)
47 return;
48 }
49 renderers_.push_back(RenderObserver(renderer));
50 } 45 }
51 46
52 void VideoTrackRenderers::RemoveRenderer(VideoRendererInterface* renderer) { 47 void VideoTrackRenderers::RemoveRenderer(VideoRendererInterface* renderer) {
53 rtc::CritScope cs(&critical_section_); 48 rtc::CritScope cs(&critical_section_);
54 std::vector<RenderObserver>::iterator it = renderers_.begin(); 49 renderers_.erase(renderer);
55 for (; it != renderers_.end(); ++it) {
56 if (it->renderer_ == renderer) {
57 renderers_.erase(it);
58 return;
59 }
60 }
61 } 50 }
62 51
63 void VideoTrackRenderers::SetEnabled(bool enable) { 52 void VideoTrackRenderers::SetEnabled(bool enable) {
64 rtc::CritScope cs(&critical_section_); 53 rtc::CritScope cs(&critical_section_);
65 enabled_ = enable; 54 enabled_ = enable;
66 } 55 }
67 56
68 bool VideoTrackRenderers::SetSize(int width, int height, int reserved) { 57 bool VideoTrackRenderers::SetSize(int width, int height, int reserved) {
69 return true; 58 return true;
70 } 59 }
71 60
72 bool VideoTrackRenderers::RenderFrame(const cricket::VideoFrame* frame) { 61 bool VideoTrackRenderers::RenderFrame(const cricket::VideoFrame* frame) {
73 rtc::CritScope cs(&critical_section_); 62 rtc::CritScope cs(&critical_section_);
74 if (!enabled_) { 63 if (!enabled_) {
75 return true; 64 return true;
76 } 65 }
77 66 for (VideoRendererInterface* renderer : renderers_) {
78 std::vector<RenderObserver>::iterator it = renderers_.begin(); 67 renderer->RenderFrame(frame);
79 for (; it != renderers_.end(); ++it) {
80 if (it->can_apply_rotation_) {
81 it->renderer_->RenderFrame(frame);
82 } else {
83 it->renderer_->RenderFrame(frame->GetCopyWithRotationApplied());
84 }
85 } 68 }
86 return true; 69 return true;
87 } 70 }
88 71
89 } // namespace webrtc 72 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/videotrackrenderers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698