OLD | NEW |
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 |
(...skipping 23 matching lines...) Expand all Loading... |
34 VideoCodecType PayloadNameToCodecType(const std::string& payload_name) { | 34 VideoCodecType PayloadNameToCodecType(const std::string& payload_name) { |
35 if (payload_name == "VP8") | 35 if (payload_name == "VP8") |
36 return kVideoCodecVP8; | 36 return kVideoCodecVP8; |
37 if (payload_name == "VP9") | 37 if (payload_name == "VP9") |
38 return kVideoCodecVP9; | 38 return kVideoCodecVP9; |
39 if (payload_name == "H264") | 39 if (payload_name == "H264") |
40 return kVideoCodecH264; | 40 return kVideoCodecH264; |
41 return kVideoCodecGeneric; | 41 return kVideoCodecGeneric; |
42 } | 42 } |
43 | 43 |
44 VideoCodec VideoEncoderConfigToVideoCodec(const VideoEncoderConfig& config, | 44 VideoCodec VideoEncoderConfigToVideoCodec( |
45 const std::string& payload_name, | 45 const VideoEncoderConfig& config, |
46 int payload_type) { | 46 const std::vector<VideoStream>& streams, |
47 const std::vector<VideoStream>& streams = config.streams; | 47 const std::string& payload_name, |
| 48 int payload_type) { |
48 static const int kEncoderMinBitrateKbps = 30; | 49 static const int kEncoderMinBitrateKbps = 30; |
49 RTC_DCHECK(!streams.empty()); | 50 RTC_DCHECK(!streams.empty()); |
50 RTC_DCHECK_GE(config.min_transmit_bitrate_bps, 0); | 51 RTC_DCHECK_GE(config.min_transmit_bitrate_bps, 0); |
51 | 52 |
52 VideoCodec video_codec; | 53 VideoCodec video_codec; |
53 memset(&video_codec, 0, sizeof(video_codec)); | 54 memset(&video_codec, 0, sizeof(video_codec)); |
54 video_codec.codecType = PayloadNameToCodecType(payload_name); | 55 video_codec.codecType = PayloadNameToCodecType(payload_name); |
55 | 56 |
56 switch (config.content_type) { | 57 switch (config.content_type) { |
57 case VideoEncoderConfig::ContentType::kRealtimeVideo: | 58 case VideoEncoderConfig::ContentType::kRealtimeVideo: |
58 video_codec.mode = kRealtimeVideo; | 59 video_codec.mode = kRealtimeVideo; |
59 break; | 60 break; |
60 case VideoEncoderConfig::ContentType::kScreen: | 61 case VideoEncoderConfig::ContentType::kScreen: |
61 video_codec.mode = kScreensharing; | 62 video_codec.mode = kScreensharing; |
62 if (config.streams.size() == 1 && | 63 if (streams.size() == 1 && |
63 config.streams[0].temporal_layer_thresholds_bps.size() == 1) { | 64 streams[0].temporal_layer_thresholds_bps.size() == 1) { |
64 video_codec.targetBitrate = | 65 video_codec.targetBitrate = |
65 config.streams[0].temporal_layer_thresholds_bps[0] / 1000; | 66 streams[0].temporal_layer_thresholds_bps[0] / 1000; |
66 } | 67 } |
67 break; | 68 break; |
68 } | 69 } |
69 | 70 |
70 switch (video_codec.codecType) { | 71 switch (video_codec.codecType) { |
71 case kVideoCodecVP8: { | 72 case kVideoCodecVP8: { |
72 if (config.encoder_specific_settings) { | 73 if (config.encoder_specific_settings) { |
73 video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>( | 74 video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>( |
74 config.encoder_specific_settings); | 75 config.encoder_specific_settings); |
75 } else { | 76 } else { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Unset max bitrate -> cap to one bit per pixel. | 173 // Unset max bitrate -> cap to one bit per pixel. |
173 video_codec.maxBitrate = | 174 video_codec.maxBitrate = |
174 (video_codec.width * video_codec.height * video_codec.maxFramerate) / | 175 (video_codec.width * video_codec.height * video_codec.maxFramerate) / |
175 1000; | 176 1000; |
176 } | 177 } |
177 if (video_codec.maxBitrate < kEncoderMinBitrateKbps) | 178 if (video_codec.maxBitrate < kEncoderMinBitrateKbps) |
178 video_codec.maxBitrate = kEncoderMinBitrateKbps; | 179 video_codec.maxBitrate = kEncoderMinBitrateKbps; |
179 | 180 |
180 RTC_DCHECK_GT(streams[0].max_framerate, 0); | 181 RTC_DCHECK_GT(streams[0].max_framerate, 0); |
181 video_codec.maxFramerate = streams[0].max_framerate; | 182 video_codec.maxFramerate = streams[0].max_framerate; |
182 video_codec.expect_encode_from_texture = config.expect_encode_from_texture; | |
183 | |
184 return video_codec; | 183 return video_codec; |
185 } | 184 } |
186 | 185 |
187 // TODO(pbos): Lower these thresholds (to closer to 100%) when we handle | 186 // TODO(pbos): Lower these thresholds (to closer to 100%) when we handle |
188 // pipelining encoders better (multiple input frames before something comes | 187 // pipelining encoders better (multiple input frames before something comes |
189 // out). This should effectively turn off CPU adaptations for systems that | 188 // out). This should effectively turn off CPU adaptations for systems that |
190 // remotely cope with the load right now. | 189 // remotely cope with the load right now. |
191 CpuOveruseOptions GetCpuOveruseOptions(bool full_overuse_time) { | 190 CpuOveruseOptions GetCpuOveruseOptions(bool full_overuse_time) { |
192 CpuOveruseOptions options; | 191 CpuOveruseOptions options; |
193 if (full_overuse_time) { | 192 if (full_overuse_time) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 275 |
277 private: | 276 private: |
278 rtc::CriticalSection crit_; | 277 rtc::CriticalSection crit_; |
279 rtc::SequencedTaskChecker main_checker_; | 278 rtc::SequencedTaskChecker main_checker_; |
280 ViEEncoder* vie_encoder_; | 279 ViEEncoder* vie_encoder_; |
281 rtc::VideoSourceInterface<VideoFrame>* source_ GUARDED_BY(&crit_); | 280 rtc::VideoSourceInterface<VideoFrame>* source_ GUARDED_BY(&crit_); |
282 | 281 |
283 RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy); | 282 RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy); |
284 }; | 283 }; |
285 | 284 |
| 285 class ViEEncoder::ConfigureEncoderTask : public rtc::QueuedTask { |
| 286 public: |
| 287 ConfigureEncoderTask(ViEEncoder* vie_encoder, |
| 288 VideoEncoderConfig config, |
| 289 size_t max_data_payload_length) |
| 290 : vie_encoder_(vie_encoder), |
| 291 config_(std::move(config)), |
| 292 max_data_payload_length_(max_data_payload_length) {} |
| 293 |
| 294 private: |
| 295 bool Run() override { |
| 296 vie_encoder_->ConfigureEncoderOnTaskQueue(std::move(config_), |
| 297 max_data_payload_length_); |
| 298 return true; |
| 299 } |
| 300 |
| 301 ViEEncoder* const vie_encoder_; |
| 302 VideoEncoderConfig config_; |
| 303 size_t max_data_payload_length_; |
| 304 }; |
| 305 |
286 ViEEncoder::ViEEncoder(uint32_t number_of_cores, | 306 ViEEncoder::ViEEncoder(uint32_t number_of_cores, |
287 SendStatisticsProxy* stats_proxy, | 307 SendStatisticsProxy* stats_proxy, |
288 const VideoSendStream::Config::EncoderSettings& settings, | 308 const VideoSendStream::Config::EncoderSettings& settings, |
289 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, | 309 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, |
290 LoadObserver* overuse_callback, | 310 LoadObserver* overuse_callback, |
291 EncodedFrameObserver* encoder_timing) | 311 EncodedFrameObserver* encoder_timing) |
292 : shutdown_event_(true /* manual_reset */, false), | 312 : shutdown_event_(true /* manual_reset */, false), |
293 number_of_cores_(number_of_cores), | 313 number_of_cores_(number_of_cores), |
294 source_proxy_(new VideoSourceProxy(this)), | 314 source_proxy_(new VideoSourceProxy(this)), |
| 315 sink_(nullptr), |
295 settings_(settings), | 316 settings_(settings), |
296 vp_(VideoProcessing::Create()), | 317 codec_type_(PayloadNameToCodecType(settings.payload_name)), |
297 video_sender_(Clock::GetRealTimeClock(), this, this), | 318 video_sender_(Clock::GetRealTimeClock(), this, this), |
298 overuse_detector_(Clock::GetRealTimeClock(), | 319 overuse_detector_(Clock::GetRealTimeClock(), |
299 GetCpuOveruseOptions(settings.full_overuse_time), | 320 GetCpuOveruseOptions(settings.full_overuse_time), |
300 this, | 321 this, |
301 encoder_timing, | 322 encoder_timing, |
302 stats_proxy), | 323 stats_proxy), |
303 load_observer_(overuse_callback), | 324 load_observer_(overuse_callback), |
304 stats_proxy_(stats_proxy), | 325 stats_proxy_(stats_proxy), |
305 pre_encode_callback_(pre_encode_callback), | 326 pre_encode_callback_(pre_encode_callback), |
306 module_process_thread_(nullptr), | 327 module_process_thread_(nullptr), |
307 encoder_config_(), | 328 pending_encoder_reconfiguration_(false), |
308 encoder_start_bitrate_bps_(0), | 329 encoder_start_bitrate_bps_(0), |
| 330 max_data_payload_length_(0), |
309 last_observed_bitrate_bps_(0), | 331 last_observed_bitrate_bps_(0), |
310 encoder_paused_and_dropped_frame_(false), | 332 encoder_paused_and_dropped_frame_(false), |
311 has_received_sli_(false), | 333 has_received_sli_(false), |
312 picture_id_sli_(0), | 334 picture_id_sli_(0), |
313 has_received_rpsi_(false), | 335 has_received_rpsi_(false), |
314 picture_id_rpsi_(0), | 336 picture_id_rpsi_(0), |
315 clock_(Clock::GetRealTimeClock()), | 337 clock_(Clock::GetRealTimeClock()), |
316 last_captured_timestamp_(0), | 338 last_captured_timestamp_(0), |
317 delta_ntp_internal_ms_(clock_->CurrentNtpInMilliseconds() - | 339 delta_ntp_internal_ms_(clock_->CurrentNtpInMilliseconds() - |
318 clock_->TimeInMilliseconds()), | 340 clock_->TimeInMilliseconds()), |
319 last_frame_log_ms_(clock_->TimeInMilliseconds()), | 341 last_frame_log_ms_(clock_->TimeInMilliseconds()), |
320 captured_frame_count_(0), | 342 captured_frame_count_(0), |
321 dropped_frame_count_(0), | 343 dropped_frame_count_(0), |
322 encoder_queue_("EncoderQueue") { | 344 encoder_queue_("EncoderQueue") { |
323 vp_->EnableTemporalDecimation(false); | |
324 | |
325 encoder_queue_.PostTask([this, encoder_timing] { | 345 encoder_queue_.PostTask([this, encoder_timing] { |
326 RTC_DCHECK_RUN_ON(&encoder_queue_); | 346 RTC_DCHECK_RUN_ON(&encoder_queue_); |
327 video_sender_.RegisterExternalEncoder( | 347 video_sender_.RegisterExternalEncoder( |
328 settings_.encoder, settings_.payload_type, settings_.internal_source); | 348 settings_.encoder, settings_.payload_type, settings_.internal_source); |
329 overuse_detector_.StartCheckForOveruse(); | 349 overuse_detector_.StartCheckForOveruse(); |
330 }); | 350 }); |
331 } | 351 } |
332 | 352 |
333 ViEEncoder::~ViEEncoder() { | 353 ViEEncoder::~ViEEncoder() { |
334 RTC_DCHECK_RUN_ON(&thread_checker_); | 354 RTC_DCHECK_RUN_ON(&thread_checker_); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 397 |
378 void ViEEncoder::SetStartBitrate(int start_bitrate_bps) { | 398 void ViEEncoder::SetStartBitrate(int start_bitrate_bps) { |
379 encoder_queue_.PostTask([this, start_bitrate_bps] { | 399 encoder_queue_.PostTask([this, start_bitrate_bps] { |
380 RTC_DCHECK_RUN_ON(&encoder_queue_); | 400 RTC_DCHECK_RUN_ON(&encoder_queue_); |
381 encoder_start_bitrate_bps_ = start_bitrate_bps; | 401 encoder_start_bitrate_bps_ = start_bitrate_bps; |
382 }); | 402 }); |
383 } | 403 } |
384 | 404 |
385 void ViEEncoder::ConfigureEncoder(VideoEncoderConfig config, | 405 void ViEEncoder::ConfigureEncoder(VideoEncoderConfig config, |
386 size_t max_data_payload_length) { | 406 size_t max_data_payload_length) { |
387 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( | 407 encoder_queue_.PostTask( |
388 config, settings_.payload_name, settings_.payload_type); | 408 std::unique_ptr<rtc::QueuedTask>(new ConfigureEncoderTask( |
389 LOG(LS_INFO) << "ConfigureEncoder: " << config.ToString(); | 409 this, std::move(config), max_data_payload_length))); |
390 std::vector<VideoStream> stream = std::move(config.streams); | |
391 int min_transmit_bitrate = config.min_transmit_bitrate_bps; | |
392 encoder_queue_.PostTask([this, video_codec, max_data_payload_length, stream, | |
393 min_transmit_bitrate] { | |
394 ConfigureEncoderInternal(video_codec, max_data_payload_length, stream, | |
395 min_transmit_bitrate); | |
396 }); | |
397 return; | |
398 } | 410 } |
399 | 411 |
400 void ViEEncoder::ConfigureEncoderInternal(const VideoCodec& video_codec, | 412 void ViEEncoder::ConfigureEncoderOnTaskQueue(VideoEncoderConfig config, |
401 size_t max_data_payload_length, | 413 size_t max_data_payload_length) { |
402 std::vector<VideoStream> stream, | |
403 int min_transmit_bitrate) { | |
404 RTC_DCHECK_RUN_ON(&encoder_queue_); | 414 RTC_DCHECK_RUN_ON(&encoder_queue_); |
405 RTC_DCHECK_GE(encoder_start_bitrate_bps_, 0); | 415 RTC_DCHECK_GE(encoder_start_bitrate_bps_, 0u); |
406 RTC_DCHECK(sink_); | 416 RTC_DCHECK(sink_); |
| 417 LOG(LS_INFO) << "ConfigureEncoder requested."; |
407 | 418 |
408 // Setting target width and height for VPM. | 419 max_data_payload_length_ = max_data_payload_length; |
409 RTC_CHECK_EQ(VPM_OK, | 420 encoder_config_ = std::move(config); |
410 vp_->SetTargetResolution(video_codec.width, video_codec.height, | 421 pending_encoder_reconfiguration_ = true; |
411 video_codec.maxFramerate)); | |
412 | 422 |
413 encoder_config_ = video_codec; | 423 // Reconfigure the encoder now if the encoder has an internal source or |
414 encoder_config_.startBitrate = encoder_start_bitrate_bps_ / 1000; | 424 // if this is the first time the encoder is configured. |
415 encoder_config_.startBitrate = | 425 // Otherwise, the reconfiguration is deferred until the next frame to minimize |
416 std::max(encoder_config_.startBitrate, video_codec.minBitrate); | 426 // the number of reconfigurations. The codec configuration depends on incoming |
417 encoder_config_.startBitrate = | 427 // video frame size. |
418 std::min(encoder_config_.startBitrate, video_codec.maxBitrate); | 428 if (!last_frame_info_ || settings_.internal_source) { |
| 429 if (!last_frame_info_) { |
| 430 last_frame_info_ = rtc::Optional<VideoFrameInfo>( |
| 431 VideoFrameInfo(176, 144, kVideoRotation_0, false)); |
| 432 } |
| 433 ReconfigureEncoder(); |
| 434 } |
| 435 } |
419 | 436 |
420 bool success = video_sender_.RegisterSendCodec( | 437 void ViEEncoder::ReconfigureEncoder() { |
421 &encoder_config_, number_of_cores_, | 438 RTC_DCHECK_RUN_ON(&encoder_queue_); |
422 static_cast<uint32_t>(max_data_payload_length)) == VCM_OK; | 439 RTC_DCHECK(pending_encoder_reconfiguration_); |
| 440 std::vector<VideoStream> streams = |
| 441 encoder_config_.encoder_stream_factory->CreateEncoderStreams( |
| 442 last_frame_info_->width, last_frame_info_->height, encoder_config_); |
423 | 443 |
| 444 VideoCodec codec = VideoEncoderConfigToVideoCodec( |
| 445 encoder_config_, streams, settings_.payload_name, settings_.payload_type); |
| 446 |
| 447 codec.startBitrate = |
| 448 std::max(encoder_start_bitrate_bps_ / 1000, codec.minBitrate); |
| 449 codec.startBitrate = std::min(codec.startBitrate, codec.maxBitrate); |
| 450 |
| 451 codec.expect_encode_from_texture = last_frame_info_->is_texture; |
| 452 |
| 453 bool success = |
| 454 video_sender_.RegisterSendCodec(&codec, number_of_cores_, |
| 455 max_data_payload_length_) == VCM_OK; |
424 if (!success) { | 456 if (!success) { |
425 LOG(LS_ERROR) << "Failed to configure encoder."; | 457 LOG(LS_ERROR) << "Failed to configure encoder."; |
426 RTC_DCHECK(success); | 458 RTC_DCHECK(success); |
427 } | 459 } |
| 460 pending_encoder_reconfiguration_ = false; |
428 | 461 |
429 if (stats_proxy_) { | 462 if (stats_proxy_) { |
430 VideoEncoderConfig::ContentType content_type = | 463 stats_proxy_->OnEncoderReconfigured(encoder_config_, streams); |
431 VideoEncoderConfig::ContentType::kRealtimeVideo; | |
432 switch (video_codec.mode) { | |
433 case kRealtimeVideo: | |
434 content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; | |
435 break; | |
436 case kScreensharing: | |
437 content_type = VideoEncoderConfig::ContentType::kScreen; | |
438 break; | |
439 default: | |
440 RTC_NOTREACHED(); | |
441 break; | |
442 } | |
443 stats_proxy_->SetContentType(content_type); | |
444 } | 464 } |
445 | 465 sink_->OnEncoderConfigurationChanged( |
446 sink_->OnEncoderConfigurationChanged(stream, min_transmit_bitrate); | 466 std::move(streams), encoder_config_.min_transmit_bitrate_bps); |
447 } | 467 } |
448 | 468 |
449 void ViEEncoder::OnFrame(const VideoFrame& video_frame) { | 469 void ViEEncoder::OnFrame(const VideoFrame& video_frame) { |
450 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_); | 470 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_); |
451 stats_proxy_->OnIncomingFrame(video_frame.width(), video_frame.height()); | 471 stats_proxy_->OnIncomingFrame(video_frame.width(), video_frame.height()); |
452 | 472 |
453 VideoFrame incoming_frame = video_frame; | 473 VideoFrame incoming_frame = video_frame; |
454 | 474 |
455 // Local time in webrtc time base. | 475 // Local time in webrtc time base. |
456 int64_t current_time = clock_->TimeInMilliseconds(); | 476 int64_t current_time = clock_->TimeInMilliseconds(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 539 } |
520 encoder_paused_and_dropped_frame_ = false; | 540 encoder_paused_and_dropped_frame_ = false; |
521 } | 541 } |
522 | 542 |
523 void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame, | 543 void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame, |
524 int64_t time_when_posted_in_ms) { | 544 int64_t time_when_posted_in_ms) { |
525 RTC_DCHECK_RUN_ON(&encoder_queue_); | 545 RTC_DCHECK_RUN_ON(&encoder_queue_); |
526 if (pre_encode_callback_) | 546 if (pre_encode_callback_) |
527 pre_encode_callback_->OnFrame(video_frame); | 547 pre_encode_callback_->OnFrame(video_frame); |
528 | 548 |
| 549 if (video_frame.width() != last_frame_info_->width || |
| 550 video_frame.height() != last_frame_info_->height || |
| 551 video_frame.rotation() != last_frame_info_->rotation || |
| 552 video_frame.is_texture() != last_frame_info_->is_texture) { |
| 553 pending_encoder_reconfiguration_ = true; |
| 554 last_frame_info_ = rtc::Optional<VideoFrameInfo>( |
| 555 VideoFrameInfo(video_frame.width(), video_frame.height(), |
| 556 video_frame.rotation(), video_frame.is_texture())); |
| 557 LOG(LS_INFO) << "Video frame parameters changed: dimensions=" |
| 558 << last_frame_info_->width << "x" << last_frame_info_->height |
| 559 << ", rotation=" << last_frame_info_->rotation |
| 560 << ", texture=" << last_frame_info_->is_texture; |
| 561 } |
| 562 |
| 563 if (pending_encoder_reconfiguration_) { |
| 564 ReconfigureEncoder(); |
| 565 } |
| 566 |
529 if (EncoderPaused()) { | 567 if (EncoderPaused()) { |
530 TraceFrameDropStart(); | 568 TraceFrameDropStart(); |
531 return; | 569 return; |
532 } | 570 } |
533 TraceFrameDropEnd(); | 571 TraceFrameDropEnd(); |
534 | 572 |
535 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", video_frame.render_time_ms(), | 573 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", video_frame.render_time_ms(), |
536 "Encode"); | 574 "Encode"); |
537 const VideoFrame* frame_to_send = &video_frame; | |
538 // TODO(wuchengli): support texture frames. | |
539 if (!video_frame.video_frame_buffer()->native_handle()) { | |
540 // Pass frame via preprocessor. | |
541 frame_to_send = vp_->PreprocessFrame(video_frame); | |
542 if (!frame_to_send) { | |
543 // Drop this frame, or there was an error processing it. | |
544 return; | |
545 } | |
546 } | |
547 | 575 |
548 overuse_detector_.FrameCaptured(video_frame, time_when_posted_in_ms); | 576 overuse_detector_.FrameCaptured(video_frame, time_when_posted_in_ms); |
549 | 577 |
550 if (encoder_config_.codecType == webrtc::kVideoCodecVP8) { | 578 if (codec_type_ == webrtc::kVideoCodecVP8) { |
551 webrtc::CodecSpecificInfo codec_specific_info; | 579 webrtc::CodecSpecificInfo codec_specific_info; |
552 codec_specific_info.codecType = webrtc::kVideoCodecVP8; | 580 codec_specific_info.codecType = webrtc::kVideoCodecVP8; |
553 | 581 |
554 codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = | 582 codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = |
555 has_received_rpsi_; | 583 has_received_rpsi_; |
556 codec_specific_info.codecSpecific.VP8.hasReceivedSLI = | 584 codec_specific_info.codecSpecific.VP8.hasReceivedSLI = |
557 has_received_sli_; | 585 has_received_sli_; |
558 codec_specific_info.codecSpecific.VP8.pictureIdRPSI = | 586 codec_specific_info.codecSpecific.VP8.pictureIdRPSI = |
559 picture_id_rpsi_; | 587 picture_id_rpsi_; |
560 codec_specific_info.codecSpecific.VP8.pictureIdSLI = | 588 codec_specific_info.codecSpecific.VP8.pictureIdSLI = |
561 picture_id_sli_; | 589 picture_id_sli_; |
562 has_received_sli_ = false; | 590 has_received_sli_ = false; |
563 has_received_rpsi_ = false; | 591 has_received_rpsi_ = false; |
564 | 592 |
565 video_sender_.AddVideoFrame(*frame_to_send, &codec_specific_info); | 593 video_sender_.AddVideoFrame(video_frame, &codec_specific_info); |
566 return; | 594 return; |
567 } | 595 } |
568 video_sender_.AddVideoFrame(*frame_to_send, nullptr); | 596 video_sender_.AddVideoFrame(video_frame, nullptr); |
569 } | 597 } |
570 | 598 |
571 void ViEEncoder::SendKeyFrame() { | 599 void ViEEncoder::SendKeyFrame() { |
572 if (!encoder_queue_.IsCurrent()) { | 600 if (!encoder_queue_.IsCurrent()) { |
573 encoder_queue_.PostTask([this] { SendKeyFrame(); }); | 601 encoder_queue_.PostTask([this] { SendKeyFrame(); }); |
574 return; | 602 return; |
575 } | 603 } |
576 RTC_DCHECK_RUN_ON(&encoder_queue_); | 604 RTC_DCHECK_RUN_ON(&encoder_queue_); |
577 video_sender_.IntraFrameRequest(0); | 605 video_sender_.IntraFrameRequest(0); |
578 } | 606 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 load_observer_->OnLoadUpdate(LoadObserver::kOveruse); | 709 load_observer_->OnLoadUpdate(LoadObserver::kOveruse); |
682 } | 710 } |
683 | 711 |
684 void ViEEncoder::NormalUsage() { | 712 void ViEEncoder::NormalUsage() { |
685 RTC_DCHECK_RUN_ON(&encoder_queue_); | 713 RTC_DCHECK_RUN_ON(&encoder_queue_); |
686 if (load_observer_) | 714 if (load_observer_) |
687 load_observer_->OnLoadUpdate(LoadObserver::kUnderuse); | 715 load_observer_->OnLoadUpdate(LoadObserver::kUnderuse); |
688 } | 716 } |
689 | 717 |
690 } // namespace webrtc | 718 } // namespace webrtc |
OLD | NEW |