OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 int event_code, | 434 int event_code, |
435 int duration) { | 435 int duration) { |
436 return (info.duration == duration && info.event_code == event_code && | 436 return (info.duration == duration && info.event_code == event_code && |
437 info.ssrc == ssrc); | 437 info.ssrc == ssrc); |
438 } | 438 } |
439 | 439 |
440 class FakeVideoMediaChannel : public RtpHelper<VideoMediaChannel> { | 440 class FakeVideoMediaChannel : public RtpHelper<VideoMediaChannel> { |
441 public: | 441 public: |
442 explicit FakeVideoMediaChannel(FakeVideoEngine* engine, | 442 explicit FakeVideoMediaChannel(FakeVideoEngine* engine, |
443 const VideoOptions& options) | 443 const VideoOptions& options) |
444 : engine_(engine), | 444 : engine_(engine), max_bps_(-1) { |
445 sent_intra_frame_(false), | |
446 requested_intra_frame_(false), | |
447 max_bps_(-1) { | |
448 SetOptions(options); | 445 SetOptions(options); |
449 } | 446 } |
450 | 447 |
451 ~FakeVideoMediaChannel(); | 448 ~FakeVideoMediaChannel(); |
452 | 449 |
453 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } | 450 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } |
454 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } | 451 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } |
455 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } | 452 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } |
456 bool rendering() const { return playout(); } | 453 bool rendering() const { return playout(); } |
457 const VideoOptions& options() const { return options_; } | 454 const VideoOptions& options() const { return options_; } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return true; | 535 return true; |
539 } | 536 } |
540 virtual bool RemoveRecvStream(uint32_t ssrc) { | 537 virtual bool RemoveRecvStream(uint32_t ssrc) { |
541 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) | 538 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) |
542 return false; | 539 return false; |
543 renderers_.erase(ssrc); | 540 renderers_.erase(ssrc); |
544 return true; | 541 return true; |
545 } | 542 } |
546 | 543 |
547 virtual bool GetStats(VideoMediaInfo* info) { return false; } | 544 virtual bool GetStats(VideoMediaInfo* info) { return false; } |
548 virtual bool SendIntraFrame() { | |
549 sent_intra_frame_ = true; | |
550 return true; | |
551 } | |
552 virtual bool RequestIntraFrame() { | |
553 requested_intra_frame_ = true; | |
554 return true; | |
555 } | |
556 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) {} | |
557 void set_sent_intra_frame(bool v) { sent_intra_frame_ = v; } | |
558 bool sent_intra_frame() const { return sent_intra_frame_; } | |
559 void set_requested_intra_frame(bool v) { requested_intra_frame_ = v; } | |
560 bool requested_intra_frame() const { return requested_intra_frame_; } | |
561 | 545 |
562 private: | 546 private: |
563 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { | 547 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { |
564 if (fail_set_recv_codecs()) { | 548 if (fail_set_recv_codecs()) { |
565 // Fake the failure in SetRecvCodecs. | 549 // Fake the failure in SetRecvCodecs. |
566 return false; | 550 return false; |
567 } | 551 } |
568 recv_codecs_ = codecs; | 552 recv_codecs_ = codecs; |
569 return true; | 553 return true; |
570 } | 554 } |
(...skipping 28 matching lines...) Expand all Loading... |
599 cricket::FOURCC_I420); | 583 cricket::FOURCC_I420); |
600 } | 584 } |
601 } | 585 } |
602 | 586 |
603 FakeVideoEngine* engine_; | 587 FakeVideoEngine* engine_; |
604 std::vector<VideoCodec> recv_codecs_; | 588 std::vector<VideoCodec> recv_codecs_; |
605 std::vector<VideoCodec> send_codecs_; | 589 std::vector<VideoCodec> send_codecs_; |
606 std::map<uint32_t, VideoRenderer*> renderers_; | 590 std::map<uint32_t, VideoRenderer*> renderers_; |
607 std::map<uint32_t, VideoFormat> send_formats_; | 591 std::map<uint32_t, VideoFormat> send_formats_; |
608 std::map<uint32_t, VideoCapturer*> capturers_; | 592 std::map<uint32_t, VideoCapturer*> capturers_; |
609 bool sent_intra_frame_; | |
610 bool requested_intra_frame_; | |
611 VideoOptions options_; | 593 VideoOptions options_; |
612 int max_bps_; | 594 int max_bps_; |
613 }; | 595 }; |
614 | 596 |
615 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { | 597 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { |
616 public: | 598 public: |
617 explicit FakeDataMediaChannel(void* unused, const DataOptions& options) | 599 explicit FakeDataMediaChannel(void* unused, const DataOptions& options) |
618 : send_blocked_(false), max_bps_(-1) {} | 600 : send_blocked_(false), max_bps_(-1) {} |
619 ~FakeDataMediaChannel() {} | 601 ~FakeDataMediaChannel() {} |
620 const std::vector<DataCodec>& recv_codecs() const { return recv_codecs_; } | 602 const std::vector<DataCodec>& recv_codecs() const { return recv_codecs_; } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 | 923 |
942 private: | 924 private: |
943 std::vector<FakeDataMediaChannel*> channels_; | 925 std::vector<FakeDataMediaChannel*> channels_; |
944 std::vector<DataCodec> data_codecs_; | 926 std::vector<DataCodec> data_codecs_; |
945 DataChannelType last_channel_type_; | 927 DataChannelType last_channel_type_; |
946 }; | 928 }; |
947 | 929 |
948 } // namespace cricket | 930 } // namespace cricket |
949 | 931 |
950 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 932 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |