| 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_receive_stream.h" | 11 #include "webrtc/video/video_receive_stream.h" |
| 12 | 12 |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 | 14 |
| 15 #include <set> |
| 15 #include <string> | 16 #include <string> |
| 16 | 17 |
| 17 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 18 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
| 19 #include "webrtc/call/congestion_controller.h" | 20 #include "webrtc/call/congestion_controller.h" |
| 20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 21 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 21 #include "webrtc/system_wrappers/include/clock.h" | 22 #include "webrtc/system_wrappers/include/clock.h" |
| 22 #include "webrtc/video/call_stats.h" | 23 #include "webrtc/video/call_stats.h" |
| 23 #include "webrtc/video/receive_statistics_proxy.h" | 24 #include "webrtc/video/receive_statistics_proxy.h" |
| 24 #include "webrtc/video_receive_stream.h" | 25 #include "webrtc/video_receive_stream.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 105 } |
| 105 | 106 |
| 106 namespace internal { | 107 namespace internal { |
| 107 namespace { | 108 namespace { |
| 108 | 109 |
| 109 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { | 110 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { |
| 110 VideoCodec codec; | 111 VideoCodec codec; |
| 111 memset(&codec, 0, sizeof(codec)); | 112 memset(&codec, 0, sizeof(codec)); |
| 112 | 113 |
| 113 codec.plType = decoder.payload_type; | 114 codec.plType = decoder.payload_type; |
| 114 strcpy(codec.plName, decoder.payload_name.c_str()); | 115 strncpy(codec.plName, decoder.payload_name.c_str(), sizeof(codec.plName)); |
| 115 if (decoder.payload_name == "VP8") { | 116 if (decoder.payload_name == "VP8") { |
| 116 codec.codecType = kVideoCodecVP8; | 117 codec.codecType = kVideoCodecVP8; |
| 117 } else if (decoder.payload_name == "VP9") { | 118 } else if (decoder.payload_name == "VP9") { |
| 118 codec.codecType = kVideoCodecVP9; | 119 codec.codecType = kVideoCodecVP9; |
| 119 } else if (decoder.payload_name == "H264") { | 120 } else if (decoder.payload_name == "H264") { |
| 120 codec.codecType = kVideoCodecH264; | 121 codec.codecType = kVideoCodecH264; |
| 121 } else { | 122 } else { |
| 122 codec.codecType = kVideoCodecGeneric; | 123 codec.codecType = kVideoCodecGeneric; |
| 123 } | 124 } |
| 124 | 125 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 RTC_NOTREACHED() << "Unsupported RTP extension."; | 222 RTC_NOTREACHED() << "Unsupported RTP extension."; |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 if (config_.rtp.fec.ulpfec_payload_type != -1) { | 226 if (config_.rtp.fec.ulpfec_payload_type != -1) { |
| 226 // ULPFEC without RED doesn't make sense. | 227 // ULPFEC without RED doesn't make sense. |
| 227 RTC_DCHECK(config_.rtp.fec.red_payload_type != -1); | 228 RTC_DCHECK(config_.rtp.fec.red_payload_type != -1); |
| 228 VideoCodec codec; | 229 VideoCodec codec; |
| 229 memset(&codec, 0, sizeof(codec)); | 230 memset(&codec, 0, sizeof(codec)); |
| 230 codec.codecType = kVideoCodecULPFEC; | 231 codec.codecType = kVideoCodecULPFEC; |
| 231 strcpy(codec.plName, "ulpfec"); | 232 strncpy(codec.plName, "ulpfec", sizeof(codec.plName)); |
| 232 codec.plType = config_.rtp.fec.ulpfec_payload_type; | 233 codec.plType = config_.rtp.fec.ulpfec_payload_type; |
| 233 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 234 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); |
| 234 } | 235 } |
| 235 if (config_.rtp.fec.red_payload_type != -1) { | 236 if (config_.rtp.fec.red_payload_type != -1) { |
| 236 VideoCodec codec; | 237 VideoCodec codec; |
| 237 memset(&codec, 0, sizeof(codec)); | 238 memset(&codec, 0, sizeof(codec)); |
| 238 codec.codecType = kVideoCodecRED; | 239 codec.codecType = kVideoCodecRED; |
| 239 strcpy(codec.plName, "red"); | 240 strncpy(codec.plName, "red", sizeof(codec.plName)); |
| 240 codec.plType = config_.rtp.fec.red_payload_type; | 241 codec.plType = config_.rtp.fec.red_payload_type; |
| 241 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 242 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); |
| 242 if (config_.rtp.fec.red_rtx_payload_type != -1) { | 243 if (config_.rtp.fec.red_rtx_payload_type != -1) { |
| 243 vie_channel_->SetRtxReceivePayloadType( | 244 vie_channel_->SetRtxReceivePayloadType( |
| 244 config_.rtp.fec.red_rtx_payload_type, | 245 config_.rtp.fec.red_rtx_payload_type, |
| 245 config_.rtp.fec.red_payload_type); | 246 config_.rtp.fec.red_payload_type); |
| 246 } | 247 } |
| 247 } | 248 } |
| 248 | 249 |
| 249 if (config.rtp.rtcp_xr.receiver_reference_time_report) | 250 if (config.rtp.rtcp_xr.receiver_reference_time_report) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 return 0; | 384 return 0; |
| 384 } | 385 } |
| 385 | 386 |
| 386 void VideoReceiveStream::SignalNetworkState(NetworkState state) { | 387 void VideoReceiveStream::SignalNetworkState(NetworkState state) { |
| 387 vie_channel_->SetRTCPMode(state == kNetworkUp ? config_.rtp.rtcp_mode | 388 vie_channel_->SetRTCPMode(state == kNetworkUp ? config_.rtp.rtcp_mode |
| 388 : RtcpMode::kOff); | 389 : RtcpMode::kOff); |
| 389 } | 390 } |
| 390 | 391 |
| 391 } // namespace internal | 392 } // namespace internal |
| 392 } // namespace webrtc | 393 } // namespace webrtc |
| OLD | NEW |