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

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: sync Created 4 years, 5 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) 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 void VideoSendStream::OveruseDetected() { 696 void VideoSendStream::OveruseDetected() {
697 if (config_.overuse_callback) 697 if (config_.overuse_callback)
698 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse); 698 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse);
699 } 699 }
700 700
701 void VideoSendStream::NormalUsage() { 701 void VideoSendStream::NormalUsage() {
702 if (config_.overuse_callback) 702 if (config_.overuse_callback)
703 config_.overuse_callback->OnLoadUpdate(LoadObserver::kUnderuse); 703 config_.overuse_callback->OnLoadUpdate(LoadObserver::kUnderuse);
704 } 704 }
705 705
706 int32_t VideoSendStream::Encoded(const EncodedImage& encoded_image, 706 EncodedImageCallback::Result VideoSendStream::OnEncodedImage(
707 const CodecSpecificInfo* codec_specific_info, 707 const EncodedImage& encoded_image,
708 const RTPFragmentationHeader* fragmentation) { 708 const CodecSpecificInfo* codec_specific_info,
709 const RTPFragmentationHeader* fragmentation) {
709 if (config_.post_encode_callback) { 710 if (config_.post_encode_callback) {
710 config_.post_encode_callback->EncodedFrameCallback( 711 config_.post_encode_callback->EncodedFrameCallback(
711 EncodedFrame(encoded_image._buffer, encoded_image._length, 712 EncodedFrame(encoded_image._buffer, encoded_image._length,
712 encoded_image._frameType)); 713 encoded_image._frameType));
713 } 714 }
714 715
715 protection_bitrate_calculator_.UpdateWithEncodedData(encoded_image); 716 protection_bitrate_calculator_.UpdateWithEncodedData(encoded_image);
716 int32_t return_value = payload_router_.Encoded( 717 EncodedImageCallback::Result result = payload_router_.OnEncodedImage(
717 encoded_image, codec_specific_info, fragmentation); 718 encoded_image, codec_specific_info, fragmentation);
718 719
719 if (kEnableFrameRecording) { 720 if (kEnableFrameRecording) {
720 int layer = codec_specific_info->codecType == kVideoCodecVP8 721 int layer = codec_specific_info->codecType == kVideoCodecVP8
721 ? codec_specific_info->codecSpecific.VP8.simulcastIdx 722 ? codec_specific_info->codecSpecific.VP8.simulcastIdx
722 : 0; 723 : 0;
723 IvfFileWriter* file_writer; 724 IvfFileWriter* file_writer;
724 { 725 {
725 if (file_writers_[layer] == nullptr) { 726 if (file_writers_[layer] == nullptr) {
726 std::ostringstream oss; 727 std::ostringstream oss;
727 oss << "send_bitstream_ssrc"; 728 oss << "send_bitstream_ssrc";
728 for (uint32_t ssrc : config_.rtp.ssrcs) 729 for (uint32_t ssrc : config_.rtp.ssrcs)
729 oss << "_" << ssrc; 730 oss << "_" << ssrc;
730 oss << "_layer" << layer << ".ivf"; 731 oss << "_layer" << layer << ".ivf";
731 file_writers_[layer] = 732 file_writers_[layer] =
732 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); 733 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType);
733 } 734 }
734 file_writer = file_writers_[layer].get(); 735 file_writer = file_writers_[layer].get();
735 } 736 }
736 if (file_writer) { 737 if (file_writer) {
737 bool ok = file_writer->WriteFrame(encoded_image); 738 bool ok = file_writer->WriteFrame(encoded_image);
738 RTC_DCHECK(ok); 739 RTC_DCHECK(ok);
739 } 740 }
740 } 741 }
741 742
742 return return_value; 743 return result;
743 } 744 }
744 745
745 void VideoSendStream::ConfigureProtection() { 746 void VideoSendStream::ConfigureProtection() {
746 // Enable NACK, FEC or both. 747 // Enable NACK, FEC or both.
747 const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0; 748 const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0;
748 bool enable_protection_fec = config_.rtp.fec.ulpfec_payload_type != -1; 749 bool enable_protection_fec = config_.rtp.fec.ulpfec_payload_type != -1;
749 // Payload types without picture ID cannot determine that a stream is complete 750 // Payload types without picture ID cannot determine that a stream is complete
750 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is 751 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is
751 // a waste of bandwidth since FEC packets still have to be transmitted. Note 752 // a waste of bandwidth since FEC packets still have to be transmitted. Note
752 // that this is not the case with FLEXFEC. 753 // that this is not the case with FLEXFEC.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 &module_nack_rate); 896 &module_nack_rate);
896 *sent_video_rate_bps += module_video_rate; 897 *sent_video_rate_bps += module_video_rate;
897 *sent_nack_rate_bps += module_nack_rate; 898 *sent_nack_rate_bps += module_nack_rate;
898 *sent_fec_rate_bps += module_fec_rate; 899 *sent_fec_rate_bps += module_fec_rate;
899 } 900 }
900 return 0; 901 return 0;
901 } 902 }
902 903
903 } // namespace internal 904 } // namespace internal
904 } // namespace webrtc 905 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698