OLD | NEW |
---|---|
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 |
11 #include "webrtc/video/video_send_stream.h" | 11 #include "webrtc/video/video_send_stream.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <sstream> | 14 #include <sstream> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
19 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
20 #include "webrtc/base/trace_event.h" | 20 #include "webrtc/base/trace_event.h" |
21 #include "webrtc/call/congestion_controller.h" | 21 #include "webrtc/call/congestion_controller.h" |
22 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 22 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
23 #include "webrtc/modules/pacing/include/packet_router.h" | 23 #include "webrtc/modules/pacing/include/packet_router.h" |
24 #include "webrtc/video/video_capture_input.h" | 24 #include "webrtc/video/video_capture_input.h" |
25 #include "webrtc/video_engine/call_stats.h" | 25 #include "webrtc/video_engine/call_stats.h" |
26 #include "webrtc/video_engine/encoder_state_feedback.h" | 26 #include "webrtc/video_engine/encoder_state_feedback.h" |
27 #include "webrtc/video_engine/payload_router.h" | 27 #include "webrtc/video_engine/payload_router.h" |
28 #include "webrtc/video_engine/vie_channel.h" | 28 #include "webrtc/video_engine/vie_channel.h" |
29 #include "webrtc/video_engine/vie_defines.h" | |
30 #include "webrtc/video_engine/vie_encoder.h" | 29 #include "webrtc/video_engine/vie_encoder.h" |
31 #include "webrtc/video_send_stream.h" | 30 #include "webrtc/video_send_stream.h" |
32 | 31 |
33 namespace webrtc { | 32 namespace webrtc { |
34 | 33 |
35 class BitrateAllocator; | 34 class BitrateAllocator; |
36 class PacedSender; | 35 class PacedSender; |
37 class RtcpIntraFrameObserver; | 36 class RtcpIntraFrameObserver; |
38 class TransportFeedbackObserver; | 37 class TransportFeedbackObserver; |
39 | 38 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 int64_t rtt_ms; | 510 int64_t rtt_ms; |
512 if (vie_channel_->GetSendRtcpStatistics(&frac_lost, &cumulative_lost, | 511 if (vie_channel_->GetSendRtcpStatistics(&frac_lost, &cumulative_lost, |
513 &extended_max_sequence_number, | 512 &extended_max_sequence_number, |
514 &jitter, &rtt_ms) == 0) { | 513 &jitter, &rtt_ms) == 0) { |
515 return rtt_ms; | 514 return rtt_ms; |
516 } | 515 } |
517 return -1; | 516 return -1; |
518 } | 517 } |
519 | 518 |
520 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { | 519 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { |
520 const int kEncoderMinBitrate = 30; | |
pbos-webrtc
2015/10/29 15:39:40
static
mflodman
2015/11/06 11:38:36
Done.
| |
521 if (video_codec.maxBitrate == 0) { | 521 if (video_codec.maxBitrate == 0) { |
522 // Unset max bitrate -> cap to one bit per pixel. | 522 // Unset max bitrate -> cap to one bit per pixel. |
523 video_codec.maxBitrate = | 523 video_codec.maxBitrate = |
524 (video_codec.width * video_codec.height * video_codec.maxFramerate) / | 524 (video_codec.width * video_codec.height * video_codec.maxFramerate) / |
525 1000; | 525 1000; |
526 } | 526 } |
527 | 527 |
528 if (video_codec.minBitrate < kViEMinCodecBitrate) | 528 if (video_codec.minBitrate < kEncoderMinBitrate) |
529 video_codec.minBitrate = kViEMinCodecBitrate; | 529 video_codec.minBitrate = kEncoderMinBitrate; |
530 if (video_codec.maxBitrate < kViEMinCodecBitrate) | 530 if (video_codec.maxBitrate < kEncoderMinBitrate) |
531 video_codec.maxBitrate = kViEMinCodecBitrate; | 531 video_codec.maxBitrate = kEncoderMinBitrate; |
532 | 532 |
533 // Stop the media flow while reconfiguring. | 533 // Stop the media flow while reconfiguring. |
534 vie_encoder_->Pause(); | 534 vie_encoder_->Pause(); |
535 | 535 |
536 if (vie_encoder_->SetEncoder(video_codec) != 0) { | 536 if (vie_encoder_->SetEncoder(video_codec) != 0) { |
537 LOG(LS_ERROR) << "Failed to set encoder."; | 537 LOG(LS_ERROR) << "Failed to set encoder."; |
538 return false; | 538 return false; |
539 } | 539 } |
540 | 540 |
541 if (vie_channel_->SetSendCodec(video_codec, false) != 0) { | 541 if (vie_channel_->SetSendCodec(video_codec, false) != 0) { |
(...skipping 14 matching lines...) Expand all Loading... | |
556 vie_channel_->IsSendingFecEnabled()); | 556 vie_channel_->IsSendingFecEnabled()); |
557 | 557 |
558 // Restart the media flow | 558 // Restart the media flow |
559 vie_encoder_->Restart(); | 559 vie_encoder_->Restart(); |
560 | 560 |
561 return true; | 561 return true; |
562 } | 562 } |
563 | 563 |
564 } // namespace internal | 564 } // namespace internal |
565 } // namespace webrtc | 565 } // namespace webrtc |
OLD | NEW |