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 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2941 | 2941 |
2942 return true; | 2942 return true; |
2943 } | 2943 } |
2944 | 2944 |
2945 void WebRtcVoiceMediaChannel::OnPacketReceived( | 2945 void WebRtcVoiceMediaChannel::OnPacketReceived( |
2946 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { | 2946 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { |
2947 DCHECK(thread_checker_.CalledOnValidThread()); | 2947 DCHECK(thread_checker_.CalledOnValidThread()); |
2948 | 2948 |
2949 // If hooked up to a "Call", forward packet there too. | 2949 // If hooked up to a "Call", forward packet there too. |
2950 if (call_) { | 2950 if (call_) { |
2951 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, | 2951 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, |
2952 reinterpret_cast<const uint8_t*>(packet->data()), packet->size()); | 2952 packet_time.not_before); |
| 2953 call_->Receiver()->DeliverPacket( |
| 2954 webrtc::MediaType::AUDIO, |
| 2955 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), |
| 2956 webrtc_packet_time); |
2953 } | 2957 } |
2954 | 2958 |
2955 // Pick which channel to send this packet to. If this packet doesn't match | 2959 // Pick which channel to send this packet to. If this packet doesn't match |
2956 // any multiplexed streams, just send it to the default channel. Otherwise, | 2960 // any multiplexed streams, just send it to the default channel. Otherwise, |
2957 // send it to the specific decoder instance for that stream. | 2961 // send it to the specific decoder instance for that stream. |
2958 int which_channel = | 2962 int which_channel = |
2959 GetReceiveChannelNum(ParseSsrc(packet->data(), packet->size(), false)); | 2963 GetReceiveChannelNum(ParseSsrc(packet->data(), packet->size(), false)); |
2960 if (which_channel == -1) { | 2964 if (which_channel == -1) { |
2961 which_channel = voe_channel(); | 2965 which_channel = voe_channel(); |
2962 } | 2966 } |
(...skipping 19 matching lines...) Expand all Loading... |
2982 which_channel, packet->data(), packet->size(), | 2986 which_channel, packet->data(), packet->size(), |
2983 webrtc::PacketTime(packet_time.timestamp, packet_time.not_before)); | 2987 webrtc::PacketTime(packet_time.timestamp, packet_time.not_before)); |
2984 } | 2988 } |
2985 | 2989 |
2986 void WebRtcVoiceMediaChannel::OnRtcpReceived( | 2990 void WebRtcVoiceMediaChannel::OnRtcpReceived( |
2987 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { | 2991 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { |
2988 DCHECK(thread_checker_.CalledOnValidThread()); | 2992 DCHECK(thread_checker_.CalledOnValidThread()); |
2989 | 2993 |
2990 // If hooked up to a "Call", forward packet there too. | 2994 // If hooked up to a "Call", forward packet there too. |
2991 if (call_) { | 2995 if (call_) { |
2992 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, | 2996 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, |
2993 reinterpret_cast<const uint8_t*>(packet->data()), packet->size()); | 2997 packet_time.not_before); |
| 2998 call_->Receiver()->DeliverPacket( |
| 2999 webrtc::MediaType::AUDIO, |
| 3000 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), |
| 3001 webrtc_packet_time); |
2994 } | 3002 } |
2995 | 3003 |
2996 // Sending channels need all RTCP packets with feedback information. | 3004 // Sending channels need all RTCP packets with feedback information. |
2997 // Even sender reports can contain attached report blocks. | 3005 // Even sender reports can contain attached report blocks. |
2998 // Receiving channels need sender reports in order to create | 3006 // Receiving channels need sender reports in order to create |
2999 // correct receiver reports. | 3007 // correct receiver reports. |
3000 int type = 0; | 3008 int type = 0; |
3001 if (!GetRtcpType(packet->data(), packet->size(), &type)) { | 3009 if (!GetRtcpType(packet->data(), packet->size(), &type)) { |
3002 LOG(LS_WARNING) << "Failed to parse type from received RTCP packet"; | 3010 LOG(LS_WARNING) << "Failed to parse type from received RTCP packet"; |
3003 return; | 3011 return; |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3613 | 3621 |
3614 int WebRtcSoundclipStream::Rewind() { | 3622 int WebRtcSoundclipStream::Rewind() { |
3615 mem_.Rewind(); | 3623 mem_.Rewind(); |
3616 // Return -1 to keep VoiceEngine from looping. | 3624 // Return -1 to keep VoiceEngine from looping. |
3617 return (loop_) ? 0 : -1; | 3625 return (loop_) ? 0 : -1; |
3618 } | 3626 } |
3619 | 3627 |
3620 } // namespace cricket | 3628 } // namespace cricket |
3621 | 3629 |
3622 #endif // HAVE_WEBRTC_VOICE | 3630 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |