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 |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 void VideoSendStream::OveruseDetected() { | 713 void VideoSendStream::OveruseDetected() { |
714 if (config_.overuse_callback) | 714 if (config_.overuse_callback) |
715 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse); | 715 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse); |
716 } | 716 } |
717 | 717 |
718 void VideoSendStream::NormalUsage() { | 718 void VideoSendStream::NormalUsage() { |
719 if (config_.overuse_callback) | 719 if (config_.overuse_callback) |
720 config_.overuse_callback->OnLoadUpdate(LoadObserver::kUnderuse); | 720 config_.overuse_callback->OnLoadUpdate(LoadObserver::kUnderuse); |
721 } | 721 } |
722 | 722 |
723 EncodedImageCallback::Result VideoSendStream::OnEncodedImage( | 723 int32_t VideoSendStream::Encoded(const EncodedImage& encoded_image, |
724 const EncodedImage& encoded_image, | 724 const CodecSpecificInfo* codec_specific_info, |
725 const CodecSpecificInfo* codec_specific_info, | 725 const RTPFragmentationHeader* fragmentation) { |
726 const RTPFragmentationHeader* fragmentation) { | |
727 if (config_.post_encode_callback) { | 726 if (config_.post_encode_callback) { |
728 config_.post_encode_callback->EncodedFrameCallback( | 727 config_.post_encode_callback->EncodedFrameCallback( |
729 EncodedFrame(encoded_image._buffer, encoded_image._length, | 728 EncodedFrame(encoded_image._buffer, encoded_image._length, |
730 encoded_image._frameType)); | 729 encoded_image._frameType)); |
731 } | 730 } |
732 | 731 |
733 protection_bitrate_calculator_.UpdateWithEncodedData(encoded_image); | 732 protection_bitrate_calculator_.UpdateWithEncodedData(encoded_image); |
734 EncodedImageCallback::Result result = payload_router_.OnEncodedImage( | 733 int32_t return_value = payload_router_.Encoded( |
735 encoded_image, codec_specific_info, fragmentation); | 734 encoded_image, codec_specific_info, fragmentation); |
736 | 735 |
737 if (kEnableFrameRecording) { | 736 if (kEnableFrameRecording) { |
738 int layer = codec_specific_info->codecType == kVideoCodecVP8 | 737 int layer = codec_specific_info->codecType == kVideoCodecVP8 |
739 ? codec_specific_info->codecSpecific.VP8.simulcastIdx | 738 ? codec_specific_info->codecSpecific.VP8.simulcastIdx |
740 : 0; | 739 : 0; |
741 IvfFileWriter* file_writer; | 740 IvfFileWriter* file_writer; |
742 { | 741 { |
743 if (file_writers_[layer] == nullptr) { | 742 if (file_writers_[layer] == nullptr) { |
744 std::ostringstream oss; | 743 std::ostringstream oss; |
745 oss << "send_bitstream_ssrc"; | 744 oss << "send_bitstream_ssrc"; |
746 for (uint32_t ssrc : config_.rtp.ssrcs) | 745 for (uint32_t ssrc : config_.rtp.ssrcs) |
747 oss << "_" << ssrc; | 746 oss << "_" << ssrc; |
748 oss << "_layer" << layer << ".ivf"; | 747 oss << "_layer" << layer << ".ivf"; |
749 file_writers_[layer] = | 748 file_writers_[layer] = |
750 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); | 749 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); |
751 } | 750 } |
752 file_writer = file_writers_[layer].get(); | 751 file_writer = file_writers_[layer].get(); |
753 } | 752 } |
754 if (file_writer) { | 753 if (file_writer) { |
755 bool ok = file_writer->WriteFrame(encoded_image); | 754 bool ok = file_writer->WriteFrame(encoded_image); |
756 RTC_DCHECK(ok); | 755 RTC_DCHECK(ok); |
757 } | 756 } |
758 } | 757 } |
759 | 758 |
760 return result; | 759 return return_value; |
761 } | 760 } |
762 | 761 |
763 void VideoSendStream::ConfigureProtection() { | 762 void VideoSendStream::ConfigureProtection() { |
764 // Enable NACK, FEC or both. | 763 // Enable NACK, FEC or both. |
765 const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0; | 764 const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0; |
766 bool enable_protection_fec = config_.rtp.fec.ulpfec_payload_type != -1; | 765 bool enable_protection_fec = config_.rtp.fec.ulpfec_payload_type != -1; |
767 // Payload types without picture ID cannot determine that a stream is complete | 766 // Payload types without picture ID cannot determine that a stream is complete |
768 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is | 767 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is |
769 // a waste of bandwidth since FEC packets still have to be transmitted. Note | 768 // a waste of bandwidth since FEC packets still have to be transmitted. Note |
770 // that this is not the case with FLEXFEC. | 769 // that this is not the case with FLEXFEC. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 &module_nack_rate); | 930 &module_nack_rate); |
932 *sent_video_rate_bps += module_video_rate; | 931 *sent_video_rate_bps += module_video_rate; |
933 *sent_nack_rate_bps += module_nack_rate; | 932 *sent_nack_rate_bps += module_nack_rate; |
934 *sent_fec_rate_bps += module_fec_rate; | 933 *sent_fec_rate_bps += module_fec_rate; |
935 } | 934 } |
936 return 0; | 935 return 0; |
937 } | 936 } |
938 | 937 |
939 } // namespace internal | 938 } // namespace internal |
940 } // namespace webrtc | 939 } // namespace webrtc |
OLD | NEW |