| 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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = | 1177 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
| 1178 receive_streams_.find(ssrc); | 1178 receive_streams_.find(ssrc); |
| 1179 if (it == receive_streams_.end()) { | 1179 if (it == receive_streams_.end()) { |
| 1180 return false; | 1180 return false; |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 it->second->SetRenderer(renderer); | 1183 it->second->SetRenderer(renderer); |
| 1184 return true; | 1184 return true; |
| 1185 } | 1185 } |
| 1186 | 1186 |
| 1187 bool WebRtcVideoChannel2::GetRenderer(uint32_t ssrc, VideoRenderer** renderer) { | |
| 1188 if (ssrc == 0) { | |
| 1189 *renderer = default_unsignalled_ssrc_handler_.GetDefaultRenderer(); | |
| 1190 return *renderer != NULL; | |
| 1191 } | |
| 1192 | |
| 1193 rtc::CritScope stream_lock(&stream_crit_); | |
| 1194 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = | |
| 1195 receive_streams_.find(ssrc); | |
| 1196 if (it == receive_streams_.end()) { | |
| 1197 return false; | |
| 1198 } | |
| 1199 *renderer = it->second->GetRenderer(); | |
| 1200 return true; | |
| 1201 } | |
| 1202 | |
| 1203 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { | 1187 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { |
| 1204 info->Clear(); | 1188 info->Clear(); |
| 1205 FillSenderStats(info); | 1189 FillSenderStats(info); |
| 1206 FillReceiverStats(info); | 1190 FillReceiverStats(info); |
| 1207 webrtc::Call::Stats stats = call_->GetStats(); | 1191 webrtc::Call::Stats stats = call_->GetStats(); |
| 1208 FillBandwidthEstimationStats(stats, info); | 1192 FillBandwidthEstimationStats(stats, info); |
| 1209 if (stats.rtt_ms != -1) { | 1193 if (stats.rtt_ms != -1) { |
| 1210 for (size_t i = 0; i < info->senders.size(); ++i) { | 1194 for (size_t i = 0; i < info->senders.size(); ++i) { |
| 1211 info->senders[i].rtt_ms = stats.rtt_ms; | 1195 info->senders[i].rtt_ms = stats.rtt_ms; |
| 1212 } | 1196 } |
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { | 2457 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { |
| 2474 return default_stream_; | 2458 return default_stream_; |
| 2475 } | 2459 } |
| 2476 | 2460 |
| 2477 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRenderer( | 2461 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRenderer( |
| 2478 cricket::VideoRenderer* renderer) { | 2462 cricket::VideoRenderer* renderer) { |
| 2479 rtc::CritScope crit(&renderer_lock_); | 2463 rtc::CritScope crit(&renderer_lock_); |
| 2480 renderer_ = renderer; | 2464 renderer_ = renderer; |
| 2481 } | 2465 } |
| 2482 | 2466 |
| 2483 VideoRenderer* WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetRenderer() { | |
| 2484 // TODO(pbos): Remove GetRenderer and all uses of it, it's thread-unsafe by | |
| 2485 // design. | |
| 2486 rtc::CritScope crit(&renderer_lock_); | |
| 2487 return renderer_; | |
| 2488 } | |
| 2489 | |
| 2490 std::string | 2467 std::string |
| 2491 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType( | 2468 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType( |
| 2492 int payload_type) { | 2469 int payload_type) { |
| 2493 for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) { | 2470 for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) { |
| 2494 if (decoder.payload_type == payload_type) { | 2471 if (decoder.payload_type == payload_type) { |
| 2495 return decoder.payload_name; | 2472 return decoder.payload_name; |
| 2496 } | 2473 } |
| 2497 } | 2474 } |
| 2498 return ""; | 2475 return ""; |
| 2499 } | 2476 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2649 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2626 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2650 } | 2627 } |
| 2651 } | 2628 } |
| 2652 | 2629 |
| 2653 return video_codecs; | 2630 return video_codecs; |
| 2654 } | 2631 } |
| 2655 | 2632 |
| 2656 } // namespace cricket | 2633 } // namespace cricket |
| 2657 | 2634 |
| 2658 #endif // HAVE_WEBRTC_VIDEO | 2635 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |