summaryrefslogtreecommitdiffstats
path: root/webkit/media/media_stream_audio_renderer.h
blob: 1efda809242d0e028c37f6fbe0a3b442f58f5d99 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// 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.

#ifndef WEBKIT_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_
#define WEBKIT_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_

#include "base/memory/ref_counted.h"
#include "base/time.h"

namespace webkit_media {

class MediaStreamAudioRenderer
    : public base::RefCountedThreadSafe<MediaStreamAudioRenderer> {
 public:
  // Starts rendering audio.
  virtual void Start() = 0;

  // Stops rendering audio.
  virtual void Stop() = 0;

  // Resumes rendering audio after being paused.
  virtual void Play() = 0;

  // Temporarily suspends rendering audio. The audio stream might still be
  // active but new audio data is not provided to the consumer.
  virtual void Pause() = 0;

  // Sets the output volume.
  virtual void SetVolume(float volume) = 0;

  // Time stamp that reflects the current render time. Should not be updated
  // when paused.
  virtual base::TimeDelta GetCurrentRenderTime() const = 0;

  // Returns true if the implementation is a local renderer and false
  // otherwise.
  virtual bool IsLocalRenderer() const = 0;

 protected:
  friend class base::RefCountedThreadSafe<MediaStreamAudioRenderer>;

  MediaStreamAudioRenderer();
  virtual ~MediaStreamAudioRenderer();

 private:
  DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioRenderer);
};

}  // namespace webkit_media

#endif  // WEBKIT_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_