#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/video/receive_statistics_proxy.h"
#include "webrtc/video_engine/include/vie_base.h"
#include "webrtc/video_engine/include/vie_capture.h"
// TODO(pbos): This is not fine grained enough...
rtp_rtcp_->SetNACKStatus(channel_, config_.rtp.nack.rtp_history_ms > 0);
rtp_rtcp_->SetKeyFrameRequestMethod(channel_, kViEKeyFrameRequestPliRtcp);
- switch (config_.rtp.rtcp_mode) {
- case newapi::kRtcpCompound:
- rtp_rtcp_->SetRTCPStatus(channel_, kRtcpCompound_RFC4585);
- break;
- case newapi::kRtcpReducedSize:
- rtp_rtcp_->SetRTCPStatus(channel_, kRtcpNonCompound_RFC5506);
- break;
- }
+ SetRtcpMode(config_.rtp.rtcp_mode);
assert(config_.rtp.remote_ssrc != 0);
// TODO(pbos): What's an appropriate local_ssrc for receive-only streams?
codec_ = ViECodec::GetInterface(video_engine);
+ if (config_.rtp.fec.ulpfec_payload_type != -1) {
+ // ULPFEC without RED doesn't make sense.
+ assert(config_.rtp.fec.red_payload_type != -1);
+ VideoCodec codec;
+ memset(&codec, 0, sizeof(codec));
+ codec.codecType = kVideoCodecULPFEC;
+ strcpy(codec.plName, "ulpfec");
+ codec.plType = config_.rtp.fec.ulpfec_payload_type;
+ if (codec_->SetReceiveCodec(channel_, codec) != 0) {
+ LOG(LS_ERROR) << "Could not set ULPFEC codec. This shouldn't happen.";
+ abort();
+ }
+ }
+ if (config_.rtp.fec.red_payload_type != -1) {
+ VideoCodec codec;
+ memset(&codec, 0, sizeof(codec));
+ codec.codecType = kVideoCodecRED;
+ strcpy(codec.plName, "red");
+ codec.plType = config_.rtp.fec.red_payload_type;
+ if (codec_->SetReceiveCodec(channel_, codec) != 0) {
+ LOG(LS_ERROR) << "Could not set RED codec. This shouldn't happen.";
+ abort();
+ }
+ }
+
assert(!config_.codecs.empty());
for (size_t i = 0; i < config_.codecs.size(); ++i) {
if (codec_->SetReceiveCodec(channel_, config_.codecs[i]) != 0) {
external_codec_ = ViEExternalCodec::GetInterface(video_engine);
for (size_t i = 0; i < config_.external_decoders.size(); ++i) {
- ExternalVideoDecoder* decoder = &config_.external_decoders[i];
+ const ExternalVideoDecoder& decoder = config_.external_decoders[i];
if (external_codec_->RegisterExternalReceiveCodec(
channel_,
- decoder->payload_type,
- decoder->decoder,
- decoder->renderer,
- decoder->expected_delay_ms) != 0) {
+ decoder.payload_type,
+ decoder.decoder,
+ decoder.renderer,
+ decoder.expected_delay_ms) != 0) {
// TODO(pbos): Abort gracefully? Can this be a runtime error?
abort();
}
rtp_rtcp_->Release();
}
-void VideoReceiveStream::StartReceiving() {
+void VideoReceiveStream::Start() {
transport_adapter_.Enable();
if (render_->StartRender(channel_) != 0)
abort();
abort();
}
-void VideoReceiveStream::StopReceiving() {
+void VideoReceiveStream::Stop() {
if (render_->StopRender(channel_) != 0)
abort();
if (video_engine_base_->StopReceive(channel_) != 0)
return 0;
}
+
+void VideoReceiveStream::SignalNetworkState(Call::NetworkState state) {
+ if (state == Call::kNetworkUp)
+ SetRtcpMode(config_.rtp.rtcp_mode);
+ network_->SetNetworkTransmissionState(channel_, state == Call::kNetworkUp);
+ if (state == Call::kNetworkDown)
+ rtp_rtcp_->SetRTCPStatus(channel_, kRtcpNone);
+}
+
+void VideoReceiveStream::SetRtcpMode(newapi::RtcpMode mode) {
+ switch (mode) {
+ case newapi::kRtcpCompound:
+ rtp_rtcp_->SetRTCPStatus(channel_, kRtcpCompound_RFC4585);
+ break;
+ case newapi::kRtcpReducedSize:
+ rtp_rtcp_->SetRTCPStatus(channel_, kRtcpNonCompound_RFC5506);
+ break;
+ }
+}
} // namespace internal
} // namespace webrtc