Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: media/cast/cast_receiver.h

Issue 214273003: [Cast] Remove AudioDecoder's dependency on WebRTC, and refactor/clean-up AudioReceiver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One moar Windows compile fix. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/cast/audio_receiver/audio_receiver_unittest.cc ('k') | media/cast/cast_receiver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This is the main interface for the cast receiver. All configuration are done 5 // This is the main interface for the cast receiver. All configuration are done
6 // at creation. 6 // at creation.
7 7
8 #ifndef MEDIA_CAST_CAST_RECEIVER_H_ 8 #ifndef MEDIA_CAST_CAST_RECEIVER_H_
9 #define MEDIA_CAST_CAST_RECEIVER_H_ 9 #define MEDIA_CAST_CAST_RECEIVER_H_
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "media/base/audio_bus.h"
16 #include "media/cast/cast_config.h" 17 #include "media/cast/cast_config.h"
17 #include "media/cast/cast_environment.h" 18 #include "media/cast/cast_environment.h"
18 19
19 namespace media { 20 namespace media {
20 class VideoFrame; 21 class VideoFrame;
21 22
22 namespace cast { 23 namespace cast {
23 24
24 namespace transport { 25 namespace transport {
25 class PacketSender; 26 class PacketSender;
26 } 27 }
27 28
28 // Callback in which the raw audio frame and play-out time will be returned 29 // Callback in which the raw audio frame, play-out time, and a continuity flag
29 // once decoding is complete. 30 // will be returned. |is_continuous| will be false to indicate the loss of
30 typedef base::Callback<void(scoped_ptr<PcmAudioFrame>, const base::TimeTicks&)> 31 // audio data due to a loss of frames (or decoding errors). This allows the
31 AudioFrameDecodedCallback; 32 // client to take steps to smooth discontinuities for playback. Note: A NULL
33 // AudioBus can be returned when data is not available (e.g., bad packet or when
34 // flushing callbacks during shutdown).
35 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus,
36 const base::TimeTicks& playout_time,
37 bool is_continuous)> AudioFrameDecodedCallback;
32 38
33 // Callback in which the encoded audio frame and play-out time will be returned. 39 // Callback in which the encoded audio frame and play-out time will be
40 // returned. The client should examine the EncodedAudioFrame::frame_id field to
41 // determine whether any frames have been dropped (i.e., frame_id should be
42 // incrementing by one each time). Note: A NULL EncodedAudioFrame can be
43 // returned on error/shutdown.
34 typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>, 44 typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>,
35 const base::TimeTicks&)> AudioFrameEncodedCallback; 45 const base::TimeTicks&)> AudioFrameEncodedCallback;
36 46
37 // Callback in which the raw frame and render time will be returned once 47 // Callback in which the raw frame and render time will be returned once
38 // decoding is complete. 48 // decoding is complete.
39 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, 49 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame,
40 const base::TimeTicks&)> VideoFrameDecodedCallback; 50 const base::TimeTicks&)> VideoFrameDecodedCallback;
41 51
42 // Callback in which the encoded video frame and render time will be returned. 52 // Callback in which the encoded video frame and render time will be returned.
43 typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>, 53 typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>,
44 const base::TimeTicks&)> VideoFrameEncodedCallback; 54 const base::TimeTicks&)> VideoFrameEncodedCallback;
45 55
46 // This Class is thread safe. 56 // This Class is thread safe.
47 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { 57 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> {
48 public: 58 public:
49 virtual void GetRawAudioFrame(int number_of_10ms_blocks, 59 virtual void GetRawAudioFrame(const AudioFrameDecodedCallback& callback) = 0;
50 int desired_frequency,
51 const AudioFrameDecodedCallback& callback) = 0;
52 60
53 virtual void GetCodedAudioFrame( 61 virtual void GetCodedAudioFrame(
54 const AudioFrameEncodedCallback& callback) = 0; 62 const AudioFrameEncodedCallback& callback) = 0;
55 63
56 virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) = 0; 64 virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) = 0;
57 65
58 virtual void GetEncodedVideoFrame( 66 virtual void GetEncodedVideoFrame(
59 const VideoFrameEncodedCallback& callback) = 0; 67 const VideoFrameEncodedCallback& callback) = 0;
60 68
61 protected: 69 protected:
(...skipping 21 matching lines...) Expand all
83 // Polling interface to get audio and video frames from the CastReceiver. 91 // Polling interface to get audio and video frames from the CastReceiver.
84 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0; 92 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0;
85 93
86 virtual ~CastReceiver() {} 94 virtual ~CastReceiver() {}
87 }; 95 };
88 96
89 } // namespace cast 97 } // namespace cast
90 } // namespace media 98 } // namespace media
91 99
92 #endif // MEDIA_CAST_CAST_RECEIVER_H_ 100 #endif // MEDIA_CAST_CAST_RECEIVER_H_
OLDNEW
« no previous file with comments | « media/cast/audio_receiver/audio_receiver_unittest.cc ('k') | media/cast/cast_receiver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698