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

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: Set EncodedImage content_type from vie_encoder Created 3 years, 9 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 FrameGeneratorCapturer::~FrameGeneratorCapturer() { 100 FrameGeneratorCapturer::~FrameGeneratorCapturer() {
101 Stop(); 101 Stop();
102 } 102 }
103 103
104 void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) { 104 void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) {
105 rtc::CritScope cs(&lock_); 105 rtc::CritScope cs(&lock_);
106 fake_rotation_ = rotation; 106 fake_rotation_ = rotation;
107 } 107 }
108 108
109 void FrameGeneratorCapturer::SetFakeContentType(
110 VideoContentTypeId content_type) {
111 rtc::CritScope cs(&lock_);
112 fake_video_content_type_ = content_type;
113 }
114
109 bool FrameGeneratorCapturer::Init() { 115 bool FrameGeneratorCapturer::Init() {
110 // This check is added because frame_generator_ might be file based and should 116 // This check is added because frame_generator_ might be file based and should
111 // not crash because a file moved. 117 // not crash because a file moved.
112 if (frame_generator_.get() == NULL) 118 if (frame_generator_.get() == NULL)
113 return false; 119 return false;
114 120
115 task_queue_.PostDelayedTask( 121 task_queue_.PostDelayedTask(
116 std::unique_ptr<rtc::QueuedTask>( 122 std::unique_ptr<rtc::QueuedTask>(
117 new InsertFrameTask(this, 1000 / target_fps_)), 123 new InsertFrameTask(this, 1000 / target_fps_)),
118 1000 / target_fps_); 124 1000 / target_fps_);
119 125
120 return true; 126 return true;
121 } 127 }
122 128
123 void FrameGeneratorCapturer::InsertFrame() { 129 void FrameGeneratorCapturer::InsertFrame() {
124 { 130 {
125 rtc::CritScope cs(&lock_); 131 rtc::CritScope cs(&lock_);
126 if (sending_) { 132 if (sending_) {
127 VideoFrame* frame = frame_generator_->NextFrame(); 133 VideoFrame* frame = frame_generator_->NextFrame();
128 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds()); 134 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds());
129 frame->set_rotation(fake_rotation_); 135 frame->set_rotation(fake_rotation_);
136 frame->set_content_type(fake_video_content_type_);
130 if (first_frame_capture_time_ == -1) { 137 if (first_frame_capture_time_ == -1) {
131 first_frame_capture_time_ = frame->ntp_time_ms(); 138 first_frame_capture_time_ = frame->ntp_time_ms();
132 } 139 }
133 if (sink_) 140 if (sink_)
134 sink_->OnFrame(*frame); 141 sink_->OnFrame(*frame);
135 } 142 }
136 } 143 }
137 } 144 }
138 145
139 void FrameGeneratorCapturer::Start() { 146 void FrameGeneratorCapturer::Start() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 183
177 void FrameGeneratorCapturer::ForceFrame() { 184 void FrameGeneratorCapturer::ForceFrame() {
178 // One-time non-repeating task, 185 // One-time non-repeating task,
179 // therefore repeat_interval_ms is 0 in InsertFrameTask() 186 // therefore repeat_interval_ms is 0 in InsertFrameTask()
180 task_queue_.PostTask( 187 task_queue_.PostTask(
181 std::unique_ptr<rtc::QueuedTask>(new InsertFrameTask(this, 0))); 188 std::unique_ptr<rtc::QueuedTask>(new InsertFrameTask(this, 0)));
182 } 189 }
183 190
184 } // namespace test 191 } // namespace test
185 } // namespace webrtc 192 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698