| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "talk/app/webrtc/audiotrack.h" | 33 #include "talk/app/webrtc/audiotrack.h" |
| 34 #include "talk/app/webrtc/dtmfsender.h" | 34 #include "talk/app/webrtc/dtmfsender.h" |
| 35 #include "talk/app/webrtc/jsepicecandidate.h" | 35 #include "talk/app/webrtc/jsepicecandidate.h" |
| 36 #include "talk/app/webrtc/jsepsessiondescription.h" | 36 #include "talk/app/webrtc/jsepsessiondescription.h" |
| 37 #include "talk/app/webrtc/mediaconstraintsinterface.h" | 37 #include "talk/app/webrtc/mediaconstraintsinterface.h" |
| 38 #include "talk/app/webrtc/mediastream.h" | 38 #include "talk/app/webrtc/mediastream.h" |
| 39 #include "talk/app/webrtc/mediastreamproxy.h" | 39 #include "talk/app/webrtc/mediastreamproxy.h" |
| 40 #include "talk/app/webrtc/mediastreamtrackproxy.h" | 40 #include "talk/app/webrtc/mediastreamtrackproxy.h" |
| 41 #include "talk/app/webrtc/remoteaudiosource.h" | 41 #include "talk/app/webrtc/remoteaudiosource.h" |
| 42 #include "talk/app/webrtc/remoteaudiotrack.h" |
| 42 #include "talk/app/webrtc/remotevideocapturer.h" | 43 #include "talk/app/webrtc/remotevideocapturer.h" |
| 43 #include "talk/app/webrtc/rtpreceiver.h" | 44 #include "talk/app/webrtc/rtpreceiver.h" |
| 44 #include "talk/app/webrtc/rtpsender.h" | 45 #include "talk/app/webrtc/rtpsender.h" |
| 45 #include "talk/app/webrtc/streamcollection.h" | 46 #include "talk/app/webrtc/streamcollection.h" |
| 46 #include "talk/app/webrtc/videosource.h" | 47 #include "talk/app/webrtc/videosource.h" |
| 47 #include "talk/app/webrtc/videotrack.h" | 48 #include "talk/app/webrtc/videotrack.h" |
| 48 #include "talk/media/sctp/sctpdataengine.h" | 49 #include "talk/media/sctp/sctpdataengine.h" |
| 49 #include "talk/session/media/channelmanager.h" | 50 #include "talk/session/media/channelmanager.h" |
| 50 #include "webrtc/base/arraysize.h" | 51 #include "webrtc/base/arraysize.h" |
| 51 #include "webrtc/base/logging.h" | 52 #include "webrtc/base/logging.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 cricket::ChannelManager* channel_manager) | 443 cricket::ChannelManager* channel_manager) |
| 443 : signaling_thread_(signaling_thread), | 444 : signaling_thread_(signaling_thread), |
| 444 channel_manager_(channel_manager) {} | 445 channel_manager_(channel_manager) {} |
| 445 | 446 |
| 446 rtc::scoped_refptr<MediaStreamInterface> CreateMediaStream( | 447 rtc::scoped_refptr<MediaStreamInterface> CreateMediaStream( |
| 447 const std::string& stream_label) { | 448 const std::string& stream_label) { |
| 448 return MediaStreamProxy::Create(signaling_thread_, | 449 return MediaStreamProxy::Create(signaling_thread_, |
| 449 MediaStream::Create(stream_label)); | 450 MediaStream::Create(stream_label)); |
| 450 } | 451 } |
| 451 | 452 |
| 452 AudioTrackInterface* AddAudioTrack(webrtc::MediaStreamInterface* stream, | 453 AudioTrackInterface* AddAudioTrack(uint32_t ssrc, |
| 454 AudioProviderInterface* provider, |
| 455 webrtc::MediaStreamInterface* stream, |
| 453 const std::string& track_id) { | 456 const std::string& track_id) { |
| 454 return AddTrack<AudioTrackInterface, AudioTrack, AudioTrackProxy>( | 457 return AddTrack<AudioTrackInterface, RemoteAudioTrack, AudioTrackProxy>( |
| 455 stream, track_id, RemoteAudioSource::Create().get()); | 458 stream, track_id, RemoteAudioSource::Create(ssrc, provider)); |
| 456 } | 459 } |
| 457 | 460 |
| 458 VideoTrackInterface* AddVideoTrack(webrtc::MediaStreamInterface* stream, | 461 VideoTrackInterface* AddVideoTrack(webrtc::MediaStreamInterface* stream, |
| 459 const std::string& track_id) { | 462 const std::string& track_id) { |
| 460 return AddTrack<VideoTrackInterface, VideoTrack, VideoTrackProxy>( | 463 return AddTrack<VideoTrackInterface, VideoTrack, VideoTrackProxy>( |
| 461 stream, track_id, | 464 stream, track_id, |
| 462 VideoSource::Create(channel_manager_, new RemoteVideoCapturer(), | 465 VideoSource::Create(channel_manager_, new RemoteVideoCapturer(), |
| 463 nullptr) | 466 nullptr) |
| 464 .get()); | 467 .get()); |
| 465 } | 468 } |
| 466 | 469 |
| 467 private: | 470 private: |
| 468 template <typename TI, typename T, typename TP, typename S> | 471 template <typename TI, typename T, typename TP, typename S> |
| 469 TI* AddTrack(MediaStreamInterface* stream, | 472 TI* AddTrack(MediaStreamInterface* stream, |
| 470 const std::string& track_id, | 473 const std::string& track_id, |
| 471 S* source) { | 474 const S& source) { |
| 472 rtc::scoped_refptr<TI> track( | 475 rtc::scoped_refptr<TI> track( |
| 473 TP::Create(signaling_thread_, T::Create(track_id, source))); | 476 TP::Create(signaling_thread_, T::Create(track_id, source))); |
| 474 track->set_state(webrtc::MediaStreamTrackInterface::kLive); | 477 track->set_state(webrtc::MediaStreamTrackInterface::kLive); |
| 475 if (stream->AddTrack(track)) { | 478 if (stream->AddTrack(track)) { |
| 476 return track; | 479 return track; |
| 477 } | 480 } |
| 478 return nullptr; | 481 return nullptr; |
| 479 } | 482 } |
| 480 | 483 |
| 481 rtc::Thread* signaling_thread_; | 484 rtc::Thread* signaling_thread_; |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 } | 1586 } |
| 1584 } | 1587 } |
| 1585 | 1588 |
| 1586 void PeerConnection::OnRemoteTrackSeen(const std::string& stream_label, | 1589 void PeerConnection::OnRemoteTrackSeen(const std::string& stream_label, |
| 1587 const std::string& track_id, | 1590 const std::string& track_id, |
| 1588 uint32_t ssrc, | 1591 uint32_t ssrc, |
| 1589 cricket::MediaType media_type) { | 1592 cricket::MediaType media_type) { |
| 1590 MediaStreamInterface* stream = remote_streams_->find(stream_label); | 1593 MediaStreamInterface* stream = remote_streams_->find(stream_label); |
| 1591 | 1594 |
| 1592 if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 1595 if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
| 1593 AudioTrackInterface* audio_track = | 1596 AudioTrackInterface* audio_track = remote_stream_factory_->AddAudioTrack( |
| 1594 remote_stream_factory_->AddAudioTrack(stream, track_id); | 1597 ssrc, session_.get(), stream, track_id); |
| 1595 CreateAudioReceiver(stream, audio_track, ssrc); | 1598 CreateAudioReceiver(stream, audio_track, ssrc); |
| 1596 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 1599 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
| 1597 VideoTrackInterface* video_track = | 1600 VideoTrackInterface* video_track = |
| 1598 remote_stream_factory_->AddVideoTrack(stream, track_id); | 1601 remote_stream_factory_->AddVideoTrack(stream, track_id); |
| 1599 CreateVideoReceiver(stream, video_track, ssrc); | 1602 CreateVideoReceiver(stream, video_track, ssrc); |
| 1600 } else { | 1603 } else { |
| 1601 RTC_DCHECK(false && "Invalid media type"); | 1604 RTC_DCHECK(false && "Invalid media type"); |
| 1602 } | 1605 } |
| 1603 } | 1606 } |
| 1604 | 1607 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { | 2032 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { |
| 2030 for (const auto& channel : sctp_data_channels_) { | 2033 for (const auto& channel : sctp_data_channels_) { |
| 2031 if (channel->id() == sid) { | 2034 if (channel->id() == sid) { |
| 2032 return channel; | 2035 return channel; |
| 2033 } | 2036 } |
| 2034 } | 2037 } |
| 2035 return nullptr; | 2038 return nullptr; |
| 2036 } | 2039 } |
| 2037 | 2040 |
| 2038 } // namespace webrtc | 2041 } // namespace webrtc |
| OLD | NEW |