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 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 // Do not return if fails. SetOutputVolumePan is not available for all | 2834 // Do not return if fails. SetOutputVolumePan is not available for all |
2835 // pltforms. | 2835 // pltforms. |
2836 } | 2836 } |
2837 LOG(LS_INFO) << "SetOutputScaling to left=" << left * scale | 2837 LOG(LS_INFO) << "SetOutputScaling to left=" << left * scale |
2838 << " right=" << right * scale | 2838 << " right=" << right * scale |
2839 << " for channel " << ch_id << " and ssrc " << ssrc; | 2839 << " for channel " << ch_id << " and ssrc " << ssrc; |
2840 } | 2840 } |
2841 return true; | 2841 return true; |
2842 } | 2842 } |
2843 | 2843 |
2844 bool WebRtcVoiceMediaChannel::GetOutputScaling( | |
2845 uint32 ssrc, double* left, double* right) { | |
2846 if (!left || !right) return false; | |
2847 | |
2848 rtc::CritScope lock(&receive_channels_cs_); | |
2849 // Determine which channel based on ssrc. | |
2850 int channel = (0 == ssrc) ? voe_channel() : GetReceiveChannelNum(ssrc); | |
2851 if (channel == -1) { | |
2852 LOG(LS_WARNING) << "Cannot find channel for ssrc:" << ssrc; | |
2853 return false; | |
2854 } | |
2855 | |
2856 float scaling; | |
2857 if (-1 == engine()->voe()->volume()->GetChannelOutputVolumeScaling( | |
2858 channel, scaling)) { | |
2859 LOG_RTCERR2(GetChannelOutputVolumeScaling, channel, scaling); | |
2860 return false; | |
2861 } | |
2862 | |
2863 float left_pan; | |
2864 float right_pan; | |
2865 if (-1 == engine()->voe()->volume()->GetOutputVolumePan( | |
2866 channel, left_pan, right_pan)) { | |
2867 LOG_RTCERR3(GetOutputVolumePan, channel, left_pan, right_pan); | |
2868 // If GetOutputVolumePan fails, we use the default left and right pan. | |
2869 left_pan = 1.0f; | |
2870 right_pan = 1.0f; | |
2871 } | |
2872 | |
2873 *left = scaling * left_pan; | |
2874 *right = scaling * right_pan; | |
2875 return true; | |
2876 } | |
2877 | |
2878 bool WebRtcVoiceMediaChannel::SetRingbackTone(const char *buf, int len) { | 2844 bool WebRtcVoiceMediaChannel::SetRingbackTone(const char *buf, int len) { |
2879 ringback_tone_.reset(new WebRtcSoundclipStream(buf, len)); | 2845 ringback_tone_.reset(new WebRtcSoundclipStream(buf, len)); |
2880 return true; | 2846 return true; |
2881 } | 2847 } |
2882 | 2848 |
2883 bool WebRtcVoiceMediaChannel::PlayRingbackTone(uint32 ssrc, | 2849 bool WebRtcVoiceMediaChannel::PlayRingbackTone(uint32 ssrc, |
2884 bool play, bool loop) { | 2850 bool play, bool loop) { |
2885 if (!ringback_tone_) { | 2851 if (!ringback_tone_) { |
2886 return false; | 2852 return false; |
2887 } | 2853 } |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3647 | 3613 |
3648 int WebRtcSoundclipStream::Rewind() { | 3614 int WebRtcSoundclipStream::Rewind() { |
3649 mem_.Rewind(); | 3615 mem_.Rewind(); |
3650 // Return -1 to keep VoiceEngine from looping. | 3616 // Return -1 to keep VoiceEngine from looping. |
3651 return (loop_) ? 0 : -1; | 3617 return (loop_) ? 0 : -1; |
3652 } | 3618 } |
3653 | 3619 |
3654 } // namespace cricket | 3620 } // namespace cricket |
3655 | 3621 |
3656 #endif // HAVE_WEBRTC_VOICE | 3622 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |