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

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 4 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
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 int32_t VideoSendStream::Encoded(const EncodedImage& encoded_image, 723 EncodedImageCallback::Result VideoSendStream::OnEncodedImage(
724 const CodecSpecificInfo* codec_specific_info, 724 const EncodedImage& encoded_image,
725 const RTPFragmentationHeader* fragmentation) { 725 const CodecSpecificInfo* codec_specific_info,
726 const RTPFragmentationHeader* fragmentation) {
726 if (config_.post_encode_callback) { 727 if (config_.post_encode_callback) {
727 config_.post_encode_callback->EncodedFrameCallback( 728 config_.post_encode_callback->EncodedFrameCallback(
728 EncodedFrame(encoded_image._buffer, encoded_image._length, 729 EncodedFrame(encoded_image._buffer, encoded_image._length,
729 encoded_image._frameType)); 730 encoded_image._frameType));
730 } 731 }
731 732
732 protection_bitrate_calculator_.UpdateWithEncodedData(encoded_image); 733 protection_bitrate_calculator_.UpdateWithEncodedData(encoded_image);
733 int32_t return_value = payload_router_.Encoded( 734 EncodedImageCallback::Result result = payload_router_.OnEncodedImage(
734 encoded_image, codec_specific_info, fragmentation); 735 encoded_image, codec_specific_info, fragmentation);
735 736
736 if (kEnableFrameRecording) { 737 if (kEnableFrameRecording) {
737 int layer = codec_specific_info->codecType == kVideoCodecVP8 738 int layer = codec_specific_info->codecType == kVideoCodecVP8
738 ? codec_specific_info->codecSpecific.VP8.simulcastIdx 739 ? codec_specific_info->codecSpecific.VP8.simulcastIdx
739 : 0; 740 : 0;
740 IvfFileWriter* file_writer; 741 IvfFileWriter* file_writer;
741 { 742 {
742 if (file_writers_[layer] == nullptr) { 743 if (file_writers_[layer] == nullptr) {
743 std::ostringstream oss; 744 std::ostringstream oss;
744 oss << "send_bitstream_ssrc"; 745 oss << "send_bitstream_ssrc";
745 for (uint32_t ssrc : config_.rtp.ssrcs) 746 for (uint32_t ssrc : config_.rtp.ssrcs)
746 oss << "_" << ssrc; 747 oss << "_" << ssrc;
747 oss << "_layer" << layer << ".ivf"; 748 oss << "_layer" << layer << ".ivf";
748 file_writers_[layer] = 749 file_writers_[layer] =
749 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); 750 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType);
750 } 751 }
751 file_writer = file_writers_[layer].get(); 752 file_writer = file_writers_[layer].get();
752 } 753 }
753 if (file_writer) { 754 if (file_writer) {
754 bool ok = file_writer->WriteFrame(encoded_image); 755 bool ok = file_writer->WriteFrame(encoded_image);
755 RTC_DCHECK(ok); 756 RTC_DCHECK(ok);
756 } 757 }
757 } 758 }
758 759
759 return return_value; 760 return result;
760 } 761 }
761 762
762 void VideoSendStream::ConfigureProtection() { 763 void VideoSendStream::ConfigureProtection() {
763 // Enable NACK, FEC or both. 764 // Enable NACK, FEC or both.
764 const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0; 765 const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0;
765 bool enable_protection_fec = config_.rtp.fec.ulpfec_payload_type != -1; 766 bool enable_protection_fec = config_.rtp.fec.ulpfec_payload_type != -1;
766 // Payload types without picture ID cannot determine that a stream is complete 767 // Payload types without picture ID cannot determine that a stream is complete
767 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is 768 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is
768 // a waste of bandwidth since FEC packets still have to be transmitted. Note 769 // a waste of bandwidth since FEC packets still have to be transmitted. Note
769 // that this is not the case with FLEXFEC. 770 // that this is not the case with FLEXFEC.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 &module_nack_rate); 931 &module_nack_rate);
931 *sent_video_rate_bps += module_video_rate; 932 *sent_video_rate_bps += module_video_rate;
932 *sent_nack_rate_bps += module_nack_rate; 933 *sent_nack_rate_bps += module_nack_rate;
933 *sent_fec_rate_bps += module_fec_rate; 934 *sent_fec_rate_bps += module_fec_rate;
934 } 935 }
935 return 0; 936 return 0;
936 } 937 }
937 938
938 } // namespace internal 939 } // namespace internal
939 } // namespace webrtc 940 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698