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

Side by Side Diff: webrtc/test/frame_generator_capturer.cc

Issue 1886113003: Add rotation to EncodedImage and make sure it is passed through encoders. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix merge mistake. Created 4 years, 8 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 | « webrtc/test/frame_generator_capturer.h ('k') | webrtc/video/end_to_end_tests.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 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 assert(frame_generator != NULL); 73 assert(frame_generator != NULL);
74 assert(target_fps > 0); 74 assert(target_fps > 0);
75 } 75 }
76 76
77 FrameGeneratorCapturer::~FrameGeneratorCapturer() { 77 FrameGeneratorCapturer::~FrameGeneratorCapturer() {
78 Stop(); 78 Stop();
79 79
80 thread_.Stop(); 80 thread_.Stop();
81 } 81 }
82 82
83 void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) {
84 rtc::CritScope cs(&lock_);
85 fake_rotation_ = rotation;
86 }
87
83 bool FrameGeneratorCapturer::Init() { 88 bool FrameGeneratorCapturer::Init() {
84 // This check is added because frame_generator_ might be file based and should 89 // This check is added because frame_generator_ might be file based and should
85 // not crash because a file moved. 90 // not crash because a file moved.
86 if (frame_generator_.get() == NULL) 91 if (frame_generator_.get() == NULL)
87 return false; 92 return false;
88 93
89 if (!tick_->StartTimer(true, 1000 / target_fps_)) 94 if (!tick_->StartTimer(true, 1000 / target_fps_))
90 return false; 95 return false;
91 thread_.Start(); 96 thread_.Start();
92 thread_.SetPriority(rtc::kHighPriority); 97 thread_.SetPriority(rtc::kHighPriority);
93 return true; 98 return true;
94 } 99 }
95 100
96 bool FrameGeneratorCapturer::Run(void* obj) { 101 bool FrameGeneratorCapturer::Run(void* obj) {
97 static_cast<FrameGeneratorCapturer*>(obj)->InsertFrame(); 102 static_cast<FrameGeneratorCapturer*>(obj)->InsertFrame();
98 return true; 103 return true;
99 } 104 }
100 105
101 void FrameGeneratorCapturer::InsertFrame() { 106 void FrameGeneratorCapturer::InsertFrame() {
102 { 107 {
103 rtc::CritScope cs(&lock_); 108 rtc::CritScope cs(&lock_);
104 if (sending_) { 109 if (sending_) {
105 VideoFrame* frame = frame_generator_->NextFrame(); 110 VideoFrame* frame = frame_generator_->NextFrame();
106 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds()); 111 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds());
112 frame->set_rotation(fake_rotation_);
107 if (first_frame_capture_time_ == -1) { 113 if (first_frame_capture_time_ == -1) {
108 first_frame_capture_time_ = frame->ntp_time_ms(); 114 first_frame_capture_time_ = frame->ntp_time_ms();
109 } 115 }
110 input_->IncomingCapturedFrame(*frame); 116 input_->IncomingCapturedFrame(*frame);
111 } 117 }
112 } 118 }
113 tick_->Wait(WEBRTC_EVENT_INFINITE); 119 tick_->Wait(WEBRTC_EVENT_INFINITE);
114 } 120 }
115 121
116 void FrameGeneratorCapturer::Start() { 122 void FrameGeneratorCapturer::Start() {
117 rtc::CritScope cs(&lock_); 123 rtc::CritScope cs(&lock_);
118 sending_ = true; 124 sending_ = true;
119 } 125 }
120 126
121 void FrameGeneratorCapturer::Stop() { 127 void FrameGeneratorCapturer::Stop() {
122 rtc::CritScope cs(&lock_); 128 rtc::CritScope cs(&lock_);
123 sending_ = false; 129 sending_ = false;
124 } 130 }
125 131
126 void FrameGeneratorCapturer::ForceFrame() { 132 void FrameGeneratorCapturer::ForceFrame() {
127 tick_->Set(); 133 tick_->Set();
128 } 134 }
129 } // test 135 } // test
130 } // webrtc 136 } // webrtc
OLDNEW
« no previous file with comments | « webrtc/test/frame_generator_capturer.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698