summaryrefslogtreecommitdiffstats
path: root/remoting/codec/audio_decoder.cc
blob: 326b4587053c3d9d0898feb052baec4542070f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/codec/audio_decoder.h"

#include "base/logging.h"
#include "remoting/codec/audio_decoder_opus.h"
#include "remoting/codec/audio_decoder_verbatim.h"
#include "remoting/protocol/session_config.h"

namespace remoting {

scoped_ptr<AudioDecoder> AudioDecoder::CreateAudioDecoder(
    const protocol::SessionConfig& config) {
  const protocol::ChannelConfig& audio_config = config.audio_config();

  if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
    return make_scoped_ptr(new AudioDecoderVerbatim());
  } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
    return make_scoped_ptr(new AudioDecoderOpus());
  }

  NOTIMPLEMENTED();
  return nullptr;
}

}  // namespace remoting