niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
niklas.enbom@webrtc.org | 5398d95 | 2012-03-26 08:11:25 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 11 | #include "webrtc/voice_engine/voe_file_impl.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 13 | #include "webrtc/modules/media_file/interface/media_file.h" |
| 14 | #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
| 15 | #include "webrtc/system_wrappers/interface/file_wrapper.h" |
| 16 | #include "webrtc/system_wrappers/interface/trace.h" |
| 17 | #include "webrtc/voice_engine/channel.h" |
| 18 | #include "webrtc/voice_engine/include/voe_errors.h" |
| 19 | #include "webrtc/voice_engine/output_mixer.h" |
| 20 | #include "webrtc/voice_engine/transmit_mixer.h" |
| 21 | #include "webrtc/voice_engine/voice_engine_impl.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | VoEFile* VoEFile::GetInterface(VoiceEngine* voiceEngine) |
| 26 | { |
| 27 | #ifndef WEBRTC_VOICE_ENGINE_FILE_API |
| 28 | return NULL; |
| 29 | #else |
| 30 | if (NULL == voiceEngine) |
| 31 | { |
| 32 | return NULL; |
| 33 | } |
tommi@webrtc.org | 0989fb7 | 2013-02-15 15:07:32 +0000 | [diff] [blame] | 34 | VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
tommi@webrtc.org | a990e12 | 2012-04-26 15:28:22 +0000 | [diff] [blame] | 35 | s->AddRef(); |
| 36 | return s; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | #endif |
| 38 | } |
| 39 | |
| 40 | #ifdef WEBRTC_VOICE_ENGINE_FILE_API |
| 41 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 42 | VoEFileImpl::VoEFileImpl(voe::SharedData* shared) : _shared(shared) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 44 | WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | "VoEFileImpl::VoEFileImpl() - ctor"); |
| 46 | } |
| 47 | |
| 48 | VoEFileImpl::~VoEFileImpl() |
| 49 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 50 | WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | "VoEFileImpl::~VoEFileImpl() - dtor"); |
| 52 | } |
| 53 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 54 | int VoEFileImpl::StartPlayingFileLocally( |
| 55 | int channel, |
| 56 | const char fileNameUTF8[1024], |
| 57 | bool loop, FileFormats format, |
| 58 | float volumeScaling, |
| 59 | int startPointMs, |
| 60 | int stopPointMs) |
| 61 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 62 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | "StartPlayingFileLocally(channel=%d, fileNameUTF8[]=%s, " |
| 64 | "loop=%d, format=%d, volumeScaling=%5.3f, startPointMs=%d," |
| 65 | " stopPointMs=%d)", |
| 66 | channel, fileNameUTF8, loop, format, volumeScaling, |
| 67 | startPointMs, stopPointMs); |
| 68 | assert(1024 == FileWrapper::kMaxFileNameSize); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 69 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 70 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 71 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 72 | return -1; |
| 73 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 74 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 75 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | if (channelPtr == NULL) |
| 77 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 78 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 79 | "StartPlayingFileLocally() failed to locate channel"); |
| 80 | return -1; |
| 81 | } |
| 82 | |
| 83 | return channelPtr->StartPlayingFileLocally(fileNameUTF8, |
| 84 | loop, |
| 85 | format, |
| 86 | startPointMs, |
| 87 | volumeScaling, |
| 88 | stopPointMs, |
| 89 | NULL); |
| 90 | } |
| 91 | |
| 92 | int VoEFileImpl::StartPlayingFileLocally(int channel, |
| 93 | InStream* stream, |
| 94 | FileFormats format, |
| 95 | float volumeScaling, |
| 96 | int startPointMs, |
| 97 | int stopPointMs) |
| 98 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 99 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 100 | "StartPlayingFileLocally(channel=%d, stream, format=%d, " |
| 101 | "volumeScaling=%5.3f, startPointMs=%d, stopPointMs=%d)", |
| 102 | channel, format, volumeScaling, startPointMs, stopPointMs); |
| 103 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 104 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 105 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 106 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | return -1; |
| 108 | } |
| 109 | |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 110 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 111 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 112 | if (channelPtr == NULL) |
| 113 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 114 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 115 | "StartPlayingFileLocally() failed to locate channel"); |
| 116 | return -1; |
| 117 | } |
| 118 | |
| 119 | return channelPtr->StartPlayingFileLocally(stream, |
| 120 | format, |
| 121 | startPointMs, |
| 122 | volumeScaling, |
| 123 | stopPointMs, |
| 124 | NULL); |
| 125 | } |
| 126 | |
| 127 | int VoEFileImpl::StopPlayingFileLocally(int channel) |
| 128 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 129 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 130 | "StopPlayingFileLocally()"); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 131 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 132 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 133 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 134 | return -1; |
| 135 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 136 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 137 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 138 | if (channelPtr == NULL) |
| 139 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 140 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 141 | "StopPlayingFileLocally() failed to locate channel"); |
| 142 | return -1; |
| 143 | } |
| 144 | return channelPtr->StopPlayingFileLocally(); |
| 145 | } |
| 146 | |
| 147 | int VoEFileImpl::IsPlayingFileLocally(int channel) |
| 148 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 149 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 150 | "IsPlayingFileLocally(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 151 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 152 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 153 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 154 | return -1; |
| 155 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 156 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 157 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 158 | if (channelPtr == NULL) |
| 159 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 160 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 161 | "StopPlayingFileLocally() failed to locate channel"); |
| 162 | return -1; |
| 163 | } |
| 164 | return channelPtr->IsPlayingFileLocally(); |
| 165 | } |
| 166 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 167 | int VoEFileImpl::StartPlayingFileAsMicrophone(int channel, |
| 168 | const char fileNameUTF8[1024], |
| 169 | bool loop, |
| 170 | bool mixWithMicrophone, |
| 171 | FileFormats format, |
| 172 | float volumeScaling) |
| 173 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 174 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 175 | "StartPlayingFileAsMicrophone(channel=%d, fileNameUTF8=%s, " |
| 176 | "loop=%d, mixWithMicrophone=%d, format=%d, " |
| 177 | "volumeScaling=%5.3f)", |
| 178 | channel, fileNameUTF8, loop, mixWithMicrophone, format, |
| 179 | volumeScaling); |
| 180 | assert(1024 == FileWrapper::kMaxFileNameSize); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 181 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 182 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 183 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 184 | return -1; |
| 185 | } |
| 186 | |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 187 | const uint32_t startPointMs(0); |
| 188 | const uint32_t stopPointMs(0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 189 | |
| 190 | if (channel == -1) |
| 191 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 192 | int res = _shared->transmit_mixer()->StartPlayingFileAsMicrophone( |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 193 | fileNameUTF8, |
| 194 | loop, |
| 195 | format, |
| 196 | startPointMs, |
| 197 | volumeScaling, |
| 198 | stopPointMs, |
| 199 | NULL); |
| 200 | if (res) |
| 201 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 202 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 203 | VoEId(_shared->instance_id(), -1), |
| 204 | "StartPlayingFileAsMicrophone() failed to start playing file"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 205 | return(-1); |
| 206 | } |
| 207 | else |
| 208 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 209 | _shared->transmit_mixer()->SetMixWithMicStatus(mixWithMicrophone); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 210 | return(0); |
| 211 | } |
| 212 | } |
| 213 | else |
| 214 | { |
| 215 | // Add file after demultiplexing <=> affects one channel only |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 216 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 217 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 218 | if (channelPtr == NULL) |
| 219 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 220 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 221 | "StartPlayingFileAsMicrophone() failed to locate channel"); |
| 222 | return -1; |
| 223 | } |
| 224 | |
| 225 | int res = channelPtr->StartPlayingFileAsMicrophone(fileNameUTF8, |
| 226 | loop, |
| 227 | format, |
| 228 | startPointMs, |
| 229 | volumeScaling, |
| 230 | stopPointMs, |
| 231 | NULL); |
| 232 | if (res) |
| 233 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 234 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 235 | VoEId(_shared->instance_id(), -1), |
| 236 | "StartPlayingFileAsMicrophone() failed to start playing file"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 237 | return -1; |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | channelPtr->SetMixWithMicStatus(mixWithMicrophone); |
| 242 | return 0; |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | int VoEFileImpl::StartPlayingFileAsMicrophone(int channel, |
| 248 | InStream* stream, |
| 249 | bool mixWithMicrophone, |
| 250 | FileFormats format, |
| 251 | float volumeScaling) |
| 252 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 253 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 254 | "StartPlayingFileAsMicrophone(channel=%d, stream," |
| 255 | " mixWithMicrophone=%d, format=%d, volumeScaling=%5.3f)", |
| 256 | channel, mixWithMicrophone, format, volumeScaling); |
| 257 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 258 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 259 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 260 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 261 | return -1; |
| 262 | } |
| 263 | |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 264 | const uint32_t startPointMs(0); |
| 265 | const uint32_t stopPointMs(0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 266 | |
| 267 | if (channel == -1) |
| 268 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 269 | int res = _shared->transmit_mixer()->StartPlayingFileAsMicrophone( |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 270 | stream, |
| 271 | format, |
| 272 | startPointMs, |
| 273 | volumeScaling, |
| 274 | stopPointMs, |
| 275 | NULL); |
| 276 | if (res) |
| 277 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 278 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 279 | VoEId(_shared->instance_id(), -1), |
| 280 | "StartPlayingFileAsMicrophone() failed to start " |
| 281 | "playing stream"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 282 | return(-1); |
| 283 | } |
| 284 | else |
| 285 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 286 | _shared->transmit_mixer()->SetMixWithMicStatus(mixWithMicrophone); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 287 | return(0); |
| 288 | } |
| 289 | } |
| 290 | else |
| 291 | { |
| 292 | // Add file after demultiplexing <=> affects one channel only |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 293 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 294 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 295 | if (channelPtr == NULL) |
| 296 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 297 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 298 | "StartPlayingFileAsMicrophone() failed to locate channel"); |
| 299 | return -1; |
| 300 | } |
| 301 | |
| 302 | int res = channelPtr->StartPlayingFileAsMicrophone( |
| 303 | stream, format, startPointMs, volumeScaling, stopPointMs, NULL); |
| 304 | if (res) |
| 305 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 306 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 307 | VoEId(_shared->instance_id(), -1), |
| 308 | "StartPlayingFileAsMicrophone() failed to start " |
| 309 | "playing stream"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 310 | return -1; |
| 311 | } |
| 312 | else |
| 313 | { |
| 314 | channelPtr->SetMixWithMicStatus(mixWithMicrophone); |
| 315 | return 0; |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | int VoEFileImpl::StopPlayingFileAsMicrophone(int channel) |
| 321 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 322 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 323 | "StopPlayingFileAsMicrophone(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 324 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 325 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 326 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 327 | return -1; |
| 328 | } |
| 329 | if (channel == -1) |
| 330 | { |
| 331 | // Stop adding file before demultiplexing <=> affects all channels |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 332 | return _shared->transmit_mixer()->StopPlayingFileAsMicrophone(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 333 | } |
| 334 | else |
| 335 | { |
| 336 | // Stop adding file after demultiplexing <=> affects one channel only |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 337 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 338 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 339 | if (channelPtr == NULL) |
| 340 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 341 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 342 | "StopPlayingFileAsMicrophone() failed to locate channel"); |
| 343 | return -1; |
| 344 | } |
| 345 | return channelPtr->StopPlayingFileAsMicrophone(); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | int VoEFileImpl::IsPlayingFileAsMicrophone(int channel) |
| 350 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 351 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 352 | "IsPlayingFileAsMicrophone(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 353 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 354 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 355 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 356 | return -1; |
| 357 | } |
| 358 | if (channel == -1) |
| 359 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 360 | return _shared->transmit_mixer()->IsPlayingFileAsMicrophone(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 361 | } |
| 362 | else |
| 363 | { |
| 364 | // Stop adding file after demultiplexing <=> affects one channel only |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 365 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 366 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 367 | if (channelPtr == NULL) |
| 368 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 369 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 370 | "IsPlayingFileAsMicrophone() failed to locate channel"); |
| 371 | return -1; |
| 372 | } |
| 373 | return channelPtr->IsPlayingFileAsMicrophone(); |
| 374 | } |
| 375 | } |
| 376 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 377 | int VoEFileImpl::StartRecordingPlayout( |
| 378 | int channel, const char* fileNameUTF8, CodecInst* compression, |
| 379 | int maxSizeBytes) |
| 380 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 381 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 382 | "StartRecordingPlayout(channel=%d, fileNameUTF8=%s, " |
| 383 | "compression, maxSizeBytes=%d)", |
| 384 | channel, fileNameUTF8, maxSizeBytes); |
| 385 | assert(1024 == FileWrapper::kMaxFileNameSize); |
| 386 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 387 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 388 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 389 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 390 | return -1; |
| 391 | } |
| 392 | if (channel == -1) |
| 393 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 394 | return _shared->output_mixer()->StartRecordingPlayout |
niklas.enbom@webrtc.org | 5398d95 | 2012-03-26 08:11:25 +0000 | [diff] [blame] | 395 | (fileNameUTF8, compression); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 396 | } |
| 397 | else |
| 398 | { |
| 399 | // Add file after demultiplexing <=> affects one channel only |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 400 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 401 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 402 | if (channelPtr == NULL) |
| 403 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 404 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 405 | "StartRecordingPlayout() failed to locate channel"); |
| 406 | return -1; |
| 407 | } |
| 408 | return channelPtr->StartRecordingPlayout(fileNameUTF8, compression); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | int VoEFileImpl::StartRecordingPlayout( |
| 413 | int channel, OutStream* stream, CodecInst* compression) |
| 414 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 415 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 416 | "StartRecordingPlayout(channel=%d, stream, compression)", |
| 417 | channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 418 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 419 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 420 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 421 | return -1; |
| 422 | } |
| 423 | if (channel == -1) |
| 424 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 425 | return _shared->output_mixer()-> |
| 426 | StartRecordingPlayout(stream, compression); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 427 | } |
| 428 | else |
| 429 | { |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 430 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 431 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 432 | if (channelPtr == NULL) |
| 433 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 434 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 435 | "StartRecordingPlayout() failed to locate channel"); |
| 436 | return -1; |
| 437 | } |
| 438 | return channelPtr->StartRecordingPlayout(stream, compression); |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | int VoEFileImpl::StopRecordingPlayout(int channel) |
| 443 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 444 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 445 | "StopRecordingPlayout(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 446 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 447 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 448 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 449 | return -1; |
| 450 | } |
| 451 | if (channel == -1) |
| 452 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 453 | return _shared->output_mixer()->StopRecordingPlayout(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 454 | } |
| 455 | else |
| 456 | { |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 457 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 458 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 459 | if (channelPtr == NULL) |
| 460 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 461 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 462 | "StopRecordingPlayout() failed to locate channel"); |
| 463 | return -1; |
| 464 | } |
| 465 | return channelPtr->StopRecordingPlayout(); |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | int VoEFileImpl::StartRecordingMicrophone( |
| 470 | const char* fileNameUTF8, CodecInst* compression, int maxSizeBytes) |
| 471 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 472 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 473 | "StartRecordingMicrophone(fileNameUTF8=%s, compression, " |
| 474 | "maxSizeBytes=%d)", fileNameUTF8, maxSizeBytes); |
| 475 | assert(1024 == FileWrapper::kMaxFileNameSize); |
| 476 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 477 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 478 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 479 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 480 | return -1; |
| 481 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 482 | if (_shared->transmit_mixer()->StartRecordingMicrophone(fileNameUTF8, |
| 483 | compression)) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 484 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 485 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 486 | VoEId(_shared->instance_id(), -1), |
| 487 | "StartRecordingMicrophone() failed to start recording"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 488 | return -1; |
| 489 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 490 | if (_shared->audio_device()->Recording()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 491 | { |
| 492 | return 0; |
| 493 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 494 | if (!_shared->ext_recording()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 495 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 496 | if (_shared->audio_device()->InitRecording() != 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 497 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 498 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 499 | VoEId(_shared->instance_id(), -1), |
| 500 | "StartRecordingMicrophone() failed to initialize recording"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 501 | return -1; |
| 502 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 503 | if (_shared->audio_device()->StartRecording() != 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 504 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 505 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 506 | VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 507 | "StartRecordingMicrophone() failed to start recording"); |
| 508 | return -1; |
| 509 | } |
| 510 | } |
| 511 | return 0; |
| 512 | } |
| 513 | |
| 514 | int VoEFileImpl::StartRecordingMicrophone( |
| 515 | OutStream* stream, CodecInst* compression) |
| 516 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 517 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 518 | "StartRecordingMicrophone(stream, compression)"); |
| 519 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 520 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 521 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 522 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 523 | return -1; |
| 524 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 525 | if (_shared->transmit_mixer()->StartRecordingMicrophone(stream, |
| 526 | compression) == -1) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 527 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 528 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 529 | VoEId(_shared->instance_id(), -1), |
| 530 | "StartRecordingMicrophone() failed to start recording"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 531 | return -1; |
| 532 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 533 | if (_shared->audio_device()->Recording()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 534 | { |
| 535 | return 0; |
| 536 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 537 | if (!_shared->ext_recording()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 538 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 539 | if (_shared->audio_device()->InitRecording() != 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 540 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 541 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 542 | VoEId(_shared->instance_id(), -1), |
| 543 | "StartRecordingMicrophone() failed to initialize recording"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 544 | return -1; |
| 545 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 546 | if (_shared->audio_device()->StartRecording() != 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 547 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 548 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 549 | VoEId(_shared->instance_id(), -1), |
| 550 | "StartRecordingMicrophone() failed to start recording"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 551 | return -1; |
| 552 | } |
| 553 | } |
| 554 | return 0; |
| 555 | } |
| 556 | |
| 557 | int VoEFileImpl::StopRecordingMicrophone() |
| 558 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 559 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 560 | "StopRecordingMicrophone()"); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 561 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 562 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 563 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 564 | return -1; |
| 565 | } |
braveyao@webrtc.org | 4de777b | 2012-06-15 02:37:53 +0000 | [diff] [blame] | 566 | |
| 567 | int err = 0; |
| 568 | |
| 569 | // TODO(xians): consider removing Start/StopRecording() in |
| 570 | // Start/StopRecordingMicrophone() if no channel is recording. |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 571 | if (_shared->NumOfSendingChannels() == 0 && |
| 572 | _shared->audio_device()->Recording()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 573 | { |
| 574 | // Stop audio-device recording if no channel is recording |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 575 | if (_shared->audio_device()->StopRecording() != 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 576 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 577 | _shared->SetLastError(VE_CANNOT_STOP_RECORDING, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 578 | "StopRecordingMicrophone() failed to stop recording"); |
braveyao@webrtc.org | 4de777b | 2012-06-15 02:37:53 +0000 | [diff] [blame] | 579 | err = -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 580 | } |
| 581 | } |
braveyao@webrtc.org | 4de777b | 2012-06-15 02:37:53 +0000 | [diff] [blame] | 582 | |
| 583 | if (_shared->transmit_mixer()->StopRecordingMicrophone() != 0) |
| 584 | { |
| 585 | WEBRTC_TRACE(kTraceError, kTraceVoice, |
| 586 | VoEId(_shared->instance_id(), -1), |
| 587 | "StopRecordingMicrophone() failed to stop recording to mixer"); |
| 588 | err = -1; |
| 589 | } |
| 590 | |
| 591 | return err; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 592 | } |
| 593 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 594 | #endif // #ifdef WEBRTC_VOICE_ENGINE_FILE_API |
andrew@webrtc.org | eeaf3d1 | 2012-01-24 06:30:02 +0000 | [diff] [blame] | 595 | |
| 596 | } // namespace webrtc |