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

Side by Side Diff: webrtc/video/vie_encoder.h

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, 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ 11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_
12 #define WEBRTC_VIDEO_VIE_ENCODER_H_ 12 #define WEBRTC_VIDEO_VIE_ENCODER_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/api/video/video_rotation.h" 18 #include "webrtc/api/video/video_rotation.h"
19 #include "webrtc/api/video/video_content_type.h"
19 #include "webrtc/base/criticalsection.h" 20 #include "webrtc/base/criticalsection.h"
20 #include "webrtc/base/event.h" 21 #include "webrtc/base/event.h"
21 #include "webrtc/base/sequenced_task_checker.h" 22 #include "webrtc/base/sequenced_task_checker.h"
22 #include "webrtc/base/task_queue.h" 23 #include "webrtc/base/task_queue.h"
23 #include "webrtc/call/call.h" 24 #include "webrtc/call/call.h"
24 #include "webrtc/common_types.h" 25 #include "webrtc/common_types.h"
25 #include "webrtc/common_video/include/video_bitrate_allocator.h" 26 #include "webrtc/common_video/include/video_bitrate_allocator.h"
26 #include "webrtc/media/base/videosinkinterface.h" 27 #include "webrtc/media/base/videosinkinterface.h"
27 #include "webrtc/modules/video_coding/include/video_coding_defines.h" 28 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
28 #include "webrtc/modules/video_coding/utility/quality_scaler.h" 29 #include "webrtc/modules/video_coding/utility/quality_scaler.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 int min_transmit_bitrate_bps) = 0; 62 int min_transmit_bitrate_bps) = 0;
62 }; 63 };
63 64
64 // Downscale resolution at most 2 times for CPU reasons. 65 // Downscale resolution at most 2 times for CPU reasons.
65 static const int kMaxCpuDowngrades = 2; 66 static const int kMaxCpuDowngrades = 2;
66 67
67 ViEEncoder(uint32_t number_of_cores, 68 ViEEncoder(uint32_t number_of_cores,
68 SendStatisticsProxy* stats_proxy, 69 SendStatisticsProxy* stats_proxy,
69 const VideoSendStream::Config::EncoderSettings& settings, 70 const VideoSendStream::Config::EncoderSettings& settings,
70 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, 71 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback,
71 EncodedFrameObserver* encoder_timing); 72 EncodedFrameObserver* encoder_timing,
73 VideoEncoderConfig::ContentType content_type);
72 ~ViEEncoder(); 74 ~ViEEncoder();
73 // RegisterProcessThread register |module_process_thread| with those objects 75 // RegisterProcessThread register |module_process_thread| with those objects
74 // that use it. Registration has to happen on the thread where 76 // that use it. Registration has to happen on the thread where
75 // |module_process_thread| was created (libjingle's worker thread). 77 // |module_process_thread| was created (libjingle's worker thread).
76 // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue. 78 // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue.
77 void RegisterProcessThread(ProcessThread* module_process_thread); 79 void RegisterProcessThread(ProcessThread* module_process_thread);
78 void DeRegisterProcessThread(); 80 void DeRegisterProcessThread();
79 81
80 // Sets the source that will provide I420 video frames. 82 // Sets the source that will provide I420 video frames.
81 // |degradation_preference| control whether or not resolution or frame rate 83 // |degradation_preference| control whether or not resolution or frame rate
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 private: 128 private:
127 class ConfigureEncoderTask; 129 class ConfigureEncoderTask;
128 class EncodeTask; 130 class EncodeTask;
129 class VideoSourceProxy; 131 class VideoSourceProxy;
130 132
131 class VideoFrameInfo { 133 class VideoFrameInfo {
132 public: 134 public:
133 VideoFrameInfo(int width, 135 VideoFrameInfo(int width,
134 int height, 136 int height,
135 VideoRotation rotation, 137 VideoRotation rotation,
138 VideoContentTypeId content_type,
136 bool is_texture) 139 bool is_texture)
137 : width(width), 140 : width(width),
138 height(height), 141 height(height),
139 rotation(rotation), 142 rotation(rotation),
143 content_type_(content_type),
140 is_texture(is_texture) {} 144 is_texture(is_texture) {}
141 int width; 145 int width;
142 int height; 146 int height;
143 VideoRotation rotation; 147 VideoRotation rotation;
148 VideoContentTypeId content_type_;
144 bool is_texture; 149 bool is_texture;
145 int pixel_count() const { return width * height; } 150 int pixel_count() const { return width * height; }
146 }; 151 };
147 152
148 void ConfigureEncoderOnTaskQueue(VideoEncoderConfig config, 153 void ConfigureEncoderOnTaskQueue(VideoEncoderConfig config,
149 size_t max_data_payload_length, 154 size_t max_data_payload_length,
150 bool nack_enabled); 155 bool nack_enabled);
151 void ReconfigureEncoder(); 156 void ReconfigureEncoder();
152 157
153 void ConfigureQualityScaler(); 158 void ConfigureQualityScaler();
(...skipping 23 matching lines...) Expand all
177 rtc::Event shutdown_event_; 182 rtc::Event shutdown_event_;
178 183
179 const uint32_t number_of_cores_; 184 const uint32_t number_of_cores_;
180 // Counts how many frames we've dropped in the initial rampup phase. 185 // Counts how many frames we've dropped in the initial rampup phase.
181 int initial_rampup_; 186 int initial_rampup_;
182 187
183 const std::unique_ptr<VideoSourceProxy> source_proxy_; 188 const std::unique_ptr<VideoSourceProxy> source_proxy_;
184 EncoderSink* sink_; 189 EncoderSink* sink_;
185 const VideoSendStream::Config::EncoderSettings settings_; 190 const VideoSendStream::Config::EncoderSettings settings_;
186 const VideoCodecType codec_type_; 191 const VideoCodecType codec_type_;
192 const VideoEncoderConfig::ContentType content_type_;
187 193
188 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); 194 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_);
189 OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_); 195 OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_);
190 std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_); 196 std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_);
191 197
192 SendStatisticsProxy* const stats_proxy_; 198 SendStatisticsProxy* const stats_proxy_;
193 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; 199 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
194 ProcessThread* module_process_thread_; 200 ProcessThread* module_process_thread_;
195 rtc::ThreadChecker module_process_thread_checker_; 201 rtc::ThreadChecker module_process_thread_checker_;
196 // |thread_checker_| checks that public methods that are related to lifetime 202 // |thread_checker_| checks that public methods that are related to lifetime
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // All public methods are proxied to |encoder_queue_|. It must must be 257 // All public methods are proxied to |encoder_queue_|. It must must be
252 // destroyed first to make sure no tasks are run that use other members. 258 // destroyed first to make sure no tasks are run that use other members.
253 rtc::TaskQueue encoder_queue_; 259 rtc::TaskQueue encoder_queue_;
254 260
255 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); 261 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder);
256 }; 262 };
257 263
258 } // namespace webrtc 264 } // namespace webrtc
259 265
260 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ 266 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698