| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 // VP9 denoising is disabled by default. | 459 // VP9 denoising is disabled by default. |
| 460 encoder_settings_.vp9.denoisingOn = | 460 encoder_settings_.vp9.denoisingOn = |
| 461 codec_default_denoising ? false : denoising; | 461 codec_default_denoising ? false : denoising; |
| 462 encoder_settings_.vp9.frameDroppingOn = frame_dropping; | 462 encoder_settings_.vp9.frameDroppingOn = frame_dropping; |
| 463 return &encoder_settings_.vp9; | 463 return &encoder_settings_.vp9; |
| 464 } | 464 } |
| 465 return NULL; | 465 return NULL; |
| 466 } | 466 } |
| 467 | 467 |
| 468 DefaultUnsignalledSsrcHandler::DefaultUnsignalledSsrcHandler() | 468 DefaultUnsignalledSsrcHandler::DefaultUnsignalledSsrcHandler() |
| 469 : default_recv_ssrc_(0), default_renderer_(NULL) {} | 469 : default_recv_ssrc_(0), default_sink_(NULL) {} |
| 470 | 470 |
| 471 UnsignalledSsrcHandler::Action DefaultUnsignalledSsrcHandler::OnUnsignalledSsrc( | 471 UnsignalledSsrcHandler::Action DefaultUnsignalledSsrcHandler::OnUnsignalledSsrc( |
| 472 WebRtcVideoChannel2* channel, | 472 WebRtcVideoChannel2* channel, |
| 473 uint32_t ssrc) { | 473 uint32_t ssrc) { |
| 474 if (default_recv_ssrc_ != 0) { // Already one default stream. | 474 if (default_recv_ssrc_ != 0) { // Already one default stream. |
| 475 LOG(LS_WARNING) << "Unknown SSRC, but default receive stream already set."; | 475 LOG(LS_WARNING) << "Unknown SSRC, but default receive stream already set."; |
| 476 return kDropPacket; | 476 return kDropPacket; |
| 477 } | 477 } |
| 478 | 478 |
| 479 StreamParams sp; | 479 StreamParams sp; |
| 480 sp.ssrcs.push_back(ssrc); | 480 sp.ssrcs.push_back(ssrc); |
| 481 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; | 481 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; |
| 482 if (!channel->AddRecvStream(sp, true)) { | 482 if (!channel->AddRecvStream(sp, true)) { |
| 483 LOG(LS_WARNING) << "Could not create default receive stream."; | 483 LOG(LS_WARNING) << "Could not create default receive stream."; |
| 484 } | 484 } |
| 485 | 485 |
| 486 channel->SetRenderer(ssrc, default_renderer_); | 486 channel->SetSink(ssrc, default_sink_); |
| 487 default_recv_ssrc_ = ssrc; | 487 default_recv_ssrc_ = ssrc; |
| 488 return kDeliverPacket; | 488 return kDeliverPacket; |
| 489 } | 489 } |
| 490 | 490 |
| 491 VideoRenderer* DefaultUnsignalledSsrcHandler::GetDefaultRenderer() const { | 491 rtc::VideoSinkInterface<VideoFrame>* |
| 492 return default_renderer_; | 492 DefaultUnsignalledSsrcHandler::GetDefaultSink() const { |
| 493 return default_sink_; |
| 493 } | 494 } |
| 494 | 495 |
| 495 void DefaultUnsignalledSsrcHandler::SetDefaultRenderer( | 496 void DefaultUnsignalledSsrcHandler::SetDefaultSink( |
| 496 VideoMediaChannel* channel, | 497 VideoMediaChannel* channel, |
| 497 VideoRenderer* renderer) { | 498 rtc::VideoSinkInterface<VideoFrame>* sink) { |
| 498 default_renderer_ = renderer; | 499 default_sink_ = sink; |
| 499 if (default_recv_ssrc_ != 0) { | 500 if (default_recv_ssrc_ != 0) { |
| 500 channel->SetRenderer(default_recv_ssrc_, default_renderer_); | 501 channel->SetSink(default_recv_ssrc_, default_sink_); |
| 501 } | 502 } |
| 502 } | 503 } |
| 503 | 504 |
| 504 WebRtcVideoEngine2::WebRtcVideoEngine2() | 505 WebRtcVideoEngine2::WebRtcVideoEngine2() |
| 505 : initialized_(false), | 506 : initialized_(false), |
| 506 external_decoder_factory_(NULL), | 507 external_decoder_factory_(NULL), |
| 507 external_encoder_factory_(NULL) { | 508 external_encoder_factory_(NULL) { |
| 508 LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2()"; | 509 LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2()"; |
| 509 video_codecs_ = GetSupportedCodecs(); | 510 video_codecs_ = GetSupportedCodecs(); |
| 510 } | 511 } |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 if (stream == receive_streams_.end()) { | 1235 if (stream == receive_streams_.end()) { |
| 1235 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; | 1236 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; |
| 1236 return false; | 1237 return false; |
| 1237 } | 1238 } |
| 1238 DeleteReceiveStream(stream->second); | 1239 DeleteReceiveStream(stream->second); |
| 1239 receive_streams_.erase(stream); | 1240 receive_streams_.erase(stream); |
| 1240 | 1241 |
| 1241 return true; | 1242 return true; |
| 1242 } | 1243 } |
| 1243 | 1244 |
| 1244 bool WebRtcVideoChannel2::SetRenderer(uint32_t ssrc, VideoRenderer* renderer) { | 1245 bool WebRtcVideoChannel2::SetSink(uint32_t ssrc, |
| 1245 LOG(LS_INFO) << "SetRenderer: ssrc:" << ssrc << " " | 1246 rtc::VideoSinkInterface<VideoFrame>* sink) { |
| 1246 << (renderer ? "(ptr)" : "NULL"); | 1247 LOG(LS_INFO) << "SetSink: ssrc:" << ssrc << " " << (sink ? "(ptr)" : "NULL"); |
| 1247 if (ssrc == 0) { | 1248 if (ssrc == 0) { |
| 1248 default_unsignalled_ssrc_handler_.SetDefaultRenderer(this, renderer); | 1249 default_unsignalled_ssrc_handler_.SetDefaultSink(this, sink); |
| 1249 return true; | 1250 return true; |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 rtc::CritScope stream_lock(&stream_crit_); | 1253 rtc::CritScope stream_lock(&stream_crit_); |
| 1253 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = | 1254 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
| 1254 receive_streams_.find(ssrc); | 1255 receive_streams_.find(ssrc); |
| 1255 if (it == receive_streams_.end()) { | 1256 if (it == receive_streams_.end()) { |
| 1256 return false; | 1257 return false; |
| 1257 } | 1258 } |
| 1258 | 1259 |
| 1259 it->second->SetSink(renderer); | 1260 it->second->SetSink(sink); |
| 1260 return true; | 1261 return true; |
| 1261 } | 1262 } |
| 1262 | 1263 |
| 1263 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { | 1264 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { |
| 1264 info->Clear(); | 1265 info->Clear(); |
| 1265 FillSenderStats(info); | 1266 FillSenderStats(info); |
| 1266 FillReceiverStats(info); | 1267 FillReceiverStats(info); |
| 1267 webrtc::Call::Stats stats = call_->GetStats(); | 1268 webrtc::Call::Stats stats = call_->GetStats(); |
| 1268 FillBandwidthEstimationStats(stats, info); | 1269 FillBandwidthEstimationStats(stats, info); |
| 1269 if (stats.rtt_ms != -1) { | 1270 if (stats.rtt_ms != -1) { |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2549 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2549 } | 2550 } |
| 2550 } | 2551 } |
| 2551 | 2552 |
| 2552 return video_codecs; | 2553 return video_codecs; |
| 2553 } | 2554 } |
| 2554 | 2555 |
| 2555 } // namespace cricket | 2556 } // namespace cricket |
| 2556 | 2557 |
| 2557 #endif // HAVE_WEBRTC_VIDEO | 2558 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |