Code: void AudioOutputDevice::OnStreamCreated(
    base::SharedMemoryHandle handle,
    base::SyncSocket::Handle socket_handle,
    int length) {
  DCHECK(message_loop()->BelongsToCurrentThread());
#if defined(OS_WIN)
  DCHECK(handle);
  DCHECK(socket_handle);
#else
  DCHECK_GE(handle.fd, 0);
  DCHECK_GE(socket_handle, 0);
#endif

   DCHECK(stream_id_);
 
  if (!audio_thread_.get())
    return;
 
  DCHECK(audio_thread_->IsStopped());
   audio_callback_.reset(new AudioOutputDevice::AudioThreadCallback(
       audio_parameters_, input_channels_, handle, length, callback_));
  audio_thread_->Start(
      audio_callback_.get(), socket_handle, "AudioOutputDevice");
 
  is_started_ = true;
  if (play_on_start_)
    PlayOnIOThread();
}

Commit Message: Revert r157378 as it caused WebRTC to dereference null pointers when restarting a call.

I've kept my unit test changes intact but disabled until I get a proper fix.

BUG=147499,150805
TBR=henrika

Review URL: https://codereview.chromium.org/10946040

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157626 0039d316-1c4b-4281-b951-d872f2087c98
CWE ID: CWE-362
void AudioOutputDevice::OnStreamCreated(
    base::SharedMemoryHandle handle,
    base::SyncSocket::Handle socket_handle,
    int length) {
  DCHECK(message_loop()->BelongsToCurrentThread());
#if defined(OS_WIN)
  DCHECK(handle);
  DCHECK(socket_handle);
#else
  DCHECK_GE(handle.fd, 0);
  DCHECK_GE(socket_handle, 0);
#endif

   DCHECK(stream_id_);
 
 
  DCHECK(audio_thread_.IsStopped());
   audio_callback_.reset(new AudioOutputDevice::AudioThreadCallback(
       audio_parameters_, input_channels_, handle, length, callback_));
  audio_thread_.Start(audio_callback_.get(), socket_handle,
      "AudioOutputDevice");
 
  is_started_ = true;
  if (play_on_start_)
    PlayOnIOThread();
}
