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

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

Issue 2772033002: Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Fix Mac CE Created 3 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
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 FrameGeneratorCapturer::~FrameGeneratorCapturer() { 120 FrameGeneratorCapturer::~FrameGeneratorCapturer() {
121 Stop(); 121 Stop();
122 } 122 }
123 123
124 void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) { 124 void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) {
125 rtc::CritScope cs(&lock_); 125 rtc::CritScope cs(&lock_);
126 fake_rotation_ = rotation; 126 fake_rotation_ = rotation;
127 } 127 }
128 128
129 void FrameGeneratorCapturer::SetFakeContentType(VideoContentType content_type) {
130 rtc::CritScope cs(&lock_);
131 fake_video_content_type_ = content_type;
132 }
133
129 bool FrameGeneratorCapturer::Init() { 134 bool FrameGeneratorCapturer::Init() {
130 // This check is added because frame_generator_ might be file based and should 135 // This check is added because frame_generator_ might be file based and should
131 // not crash because a file moved. 136 // not crash because a file moved.
132 if (frame_generator_.get() == NULL) 137 if (frame_generator_.get() == NULL)
133 return false; 138 return false;
134 139
135 task_queue_.PostDelayedTask( 140 task_queue_.PostDelayedTask(
136 std::unique_ptr<rtc::QueuedTask>( 141 std::unique_ptr<rtc::QueuedTask>(
137 new InsertFrameTask(this, 1000 / target_fps_)), 142 new InsertFrameTask(this, 1000 / target_fps_)),
138 1000 / target_fps_); 143 1000 / target_fps_);
139 144
140 return true; 145 return true;
141 } 146 }
142 147
143 void FrameGeneratorCapturer::InsertFrame() { 148 void FrameGeneratorCapturer::InsertFrame() {
144 { 149 {
145 rtc::CritScope cs(&lock_); 150 rtc::CritScope cs(&lock_);
146 if (sending_) { 151 if (sending_) {
147 VideoFrame* frame = frame_generator_->NextFrame(); 152 VideoFrame* frame = frame_generator_->NextFrame();
148 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds()); 153 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds());
149 frame->set_rotation(fake_rotation_); 154 frame->set_rotation(fake_rotation_);
155 frame->set_content_type(fake_video_content_type_);
150 if (first_frame_capture_time_ == -1) { 156 if (first_frame_capture_time_ == -1) {
151 first_frame_capture_time_ = frame->ntp_time_ms(); 157 first_frame_capture_time_ = frame->ntp_time_ms();
152 } 158 }
153 if (sink_) 159 if (sink_)
154 sink_->OnFrame(*frame); 160 sink_->OnFrame(*frame);
155 } 161 }
156 } 162 }
157 } 163 }
158 164
159 void FrameGeneratorCapturer::Start() { 165 void FrameGeneratorCapturer::Start() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 202
197 void FrameGeneratorCapturer::ForceFrame() { 203 void FrameGeneratorCapturer::ForceFrame() {
198 // One-time non-repeating task, 204 // One-time non-repeating task,
199 // therefore repeat_interval_ms is 0 in InsertFrameTask() 205 // therefore repeat_interval_ms is 0 in InsertFrameTask()
200 task_queue_.PostTask( 206 task_queue_.PostTask(
201 std::unique_ptr<rtc::QueuedTask>(new InsertFrameTask(this, 0))); 207 std::unique_ptr<rtc::QueuedTask>(new InsertFrameTask(this, 0)));
202 } 208 }
203 209
204 } // namespace test 210 } // namespace test
205 } // namespace webrtc 211 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698