OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return false; | 332 return false; |
333 } | 333 } |
334 if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, !enable)) { | 334 if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, !enable)) { |
335 return false; | 335 return false; |
336 } | 336 } |
337 if (enable && options) { | 337 if (enable && options) { |
338 return SetOptions(*options); | 338 return SetOptions(*options); |
339 } | 339 } |
340 return true; | 340 return true; |
341 } | 341 } |
| 342 |
| 343 bool HasSource(uint32_t ssrc) const { |
| 344 return local_sinks_.find(ssrc) != local_sinks_.end(); |
| 345 } |
| 346 |
342 virtual bool AddRecvStream(const StreamParams& sp) { | 347 virtual bool AddRecvStream(const StreamParams& sp) { |
343 if (!RtpHelper<VoiceMediaChannel>::AddRecvStream(sp)) | 348 if (!RtpHelper<VoiceMediaChannel>::AddRecvStream(sp)) |
344 return false; | 349 return false; |
345 output_scalings_[sp.first_ssrc()] = 1.0; | 350 output_scalings_[sp.first_ssrc()] = 1.0; |
346 return true; | 351 return true; |
347 } | 352 } |
348 virtual bool RemoveRecvStream(uint32_t ssrc) { | 353 virtual bool RemoveRecvStream(uint32_t ssrc) { |
349 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) | 354 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) |
350 return false; | 355 return false; |
351 output_scalings_.erase(ssrc); | 356 output_scalings_.erase(ssrc); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 bool SetSink(uint32_t ssrc, | 543 bool SetSink(uint32_t ssrc, |
539 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { | 544 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { |
540 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { | 545 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { |
541 return false; | 546 return false; |
542 } | 547 } |
543 if (ssrc != 0) { | 548 if (ssrc != 0) { |
544 sinks_[ssrc] = sink; | 549 sinks_[ssrc] = sink; |
545 } | 550 } |
546 return true; | 551 return true; |
547 } | 552 } |
| 553 bool HasSink(uint32_t ssrc) const { |
| 554 return sinks_.find(ssrc) != sinks_.end() && sinks_.at(ssrc) != nullptr; |
| 555 } |
548 | 556 |
549 bool SetSend(bool send) override { return set_sending(send); } | 557 bool SetSend(bool send) override { return set_sending(send); } |
550 bool SetVideoSend( | 558 bool SetVideoSend( |
551 uint32_t ssrc, | 559 uint32_t ssrc, |
552 bool enable, | 560 bool enable, |
553 const VideoOptions* options, | 561 const VideoOptions* options, |
554 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { | 562 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { |
555 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { | 563 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { |
556 return false; | 564 return false; |
557 } | 565 } |
558 if (enable && options) { | 566 if (enable && options) { |
559 return SetOptions(*options); | 567 if (!SetOptions(*options)) { |
| 568 return false; |
| 569 } |
560 } | 570 } |
561 sources_[ssrc] = source; | 571 sources_[ssrc] = source; |
562 return true; | 572 return true; |
563 } | 573 } |
564 | 574 |
565 bool HasSource(uint32_t ssrc) const { | 575 bool HasSource(uint32_t ssrc) const { |
566 return sources_.find(ssrc) != sources_.end(); | 576 return sources_.find(ssrc) != sources_.end() && |
| 577 sources_.at(ssrc) != nullptr; |
567 } | 578 } |
568 bool AddRecvStream(const StreamParams& sp) override { | 579 bool AddRecvStream(const StreamParams& sp) override { |
569 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) | 580 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) |
570 return false; | 581 return false; |
571 sinks_[sp.first_ssrc()] = NULL; | 582 sinks_[sp.first_ssrc()] = NULL; |
572 return true; | 583 return true; |
573 } | 584 } |
574 bool RemoveRecvStream(uint32_t ssrc) override { | 585 bool RemoveRecvStream(uint32_t ssrc) override { |
575 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) | 586 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) |
576 return false; | 587 return false; |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 | 967 |
957 private: | 968 private: |
958 std::vector<FakeDataMediaChannel*> channels_; | 969 std::vector<FakeDataMediaChannel*> channels_; |
959 std::vector<DataCodec> data_codecs_; | 970 std::vector<DataCodec> data_codecs_; |
960 DataChannelType last_channel_type_; | 971 DataChannelType last_channel_type_; |
961 }; | 972 }; |
962 | 973 |
963 } // namespace cricket | 974 } // namespace cricket |
964 | 975 |
965 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 976 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |