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

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

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « media/cast/cast_environment.cc ('k') | media/cast/cast_sender.h » ('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 <memory>
12
11 #include "base/callback.h" 13 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "media/base/audio_bus.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 #include "media/cast/net/cast_transport.h" 19 #include "media/cast/net/cast_transport.h"
19 20
20 namespace media { 21 namespace media {
21 class VideoFrame; 22 class VideoFrame;
22 23
23 namespace cast { 24 namespace cast {
24 25
25 // The following callbacks are used to deliver decoded audio/video frame data, 26 // The following callbacks are used to deliver decoded audio/video frame data,
26 // the frame's corresponding play-out time, and a continuity flag. 27 // the frame's corresponding play-out time, and a continuity flag.
27 // |is_continuous| will be false to indicate the loss of data due to a loss of 28 // |is_continuous| will be false to indicate the loss of data due to a loss of
28 // frames (or decoding errors). This allows the client to take steps to smooth 29 // frames (or decoding errors). This allows the client to take steps to smooth
29 // discontinuities for playback. Note: A NULL pointer can be returned when data 30 // discontinuities for playback. Note: A NULL pointer can be returned when data
30 // is not available (e.g., bad/missing packet). 31 // is not available (e.g., bad/missing packet).
31 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, 32 typedef base::Callback<void(std::unique_ptr<AudioBus> audio_bus,
32 const base::TimeTicks& playout_time, 33 const base::TimeTicks& playout_time,
33 bool is_continuous)> AudioFrameDecodedCallback; 34 bool is_continuous)>
35 AudioFrameDecodedCallback;
34 // TODO(miu): |video_frame| includes a timestamp, so use that instead. 36 // TODO(miu): |video_frame| includes a timestamp, so use that instead.
35 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, 37 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame,
36 const base::TimeTicks& playout_time, 38 const base::TimeTicks& playout_time,
37 bool is_continuous)> VideoFrameDecodedCallback; 39 bool is_continuous)> VideoFrameDecodedCallback;
38 40
39 // The following callback delivers encoded frame data and metadata. The client 41 // The following callback delivers encoded frame data and metadata. The client
40 // should examine the |frame_id| field to determine whether any frames have been 42 // should examine the |frame_id| field to determine whether any frames have been
41 // dropped (i.e., frame_id should be incrementing by one each time). Note: A 43 // dropped (i.e., frame_id should be incrementing by one each time). Note: A
42 // NULL pointer can be returned on error. 44 // NULL pointer can be returned on error.
43 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> 45 typedef base::Callback<void(std::unique_ptr<EncodedFrame>)>
44 ReceiveEncodedFrameCallback; 46 ReceiveEncodedFrameCallback;
45 47
46 class CastReceiver { 48 class CastReceiver {
47 public: 49 public:
48 static scoped_ptr<CastReceiver> Create( 50 static std::unique_ptr<CastReceiver> Create(
49 scoped_refptr<CastEnvironment> cast_environment, 51 scoped_refptr<CastEnvironment> cast_environment,
50 const FrameReceiverConfig& audio_config, 52 const FrameReceiverConfig& audio_config,
51 const FrameReceiverConfig& video_config, 53 const FrameReceiverConfig& video_config,
52 CastTransport* const transport); 54 CastTransport* const transport);
53 55
54 // All received RTP and RTCP packets for the call should be sent to this 56 // All received RTP and RTCP packets for the call should be sent to this
55 // PacketReceiver. Can be called from any thread. 57 // PacketReceiver. Can be called from any thread.
56 virtual void ReceivePacket(scoped_ptr<Packet> packet) = 0; 58 virtual void ReceivePacket(std::unique_ptr<Packet> packet) = 0;
57 59
58 // Polling interface to get audio and video frames from the CastReceiver. The 60 // Polling interface to get audio and video frames from the CastReceiver. The
59 // the RequestDecodedXXXXXFrame() methods utilize internal software-based 61 // the RequestDecodedXXXXXFrame() methods utilize internal software-based
60 // decoding, while the RequestEncodedXXXXXFrame() methods provides 62 // decoding, while the RequestEncodedXXXXXFrame() methods provides
61 // still-encoded frames for use with external/hardware decoders. 63 // still-encoded frames for use with external/hardware decoders.
62 // 64 //
63 // In all cases, the given |callback| is guaranteed to be run at some point in 65 // In all cases, the given |callback| is guaranteed to be run at some point in
64 // the future, except for those requests still enqueued at destruction time. 66 // the future, except for those requests still enqueued at destruction time.
65 // 67 //
66 // These methods should all be called on the CastEnvironment's MAIN thread. 68 // These methods should all be called on the CastEnvironment's MAIN thread.
67 virtual void RequestDecodedAudioFrame( 69 virtual void RequestDecodedAudioFrame(
68 const AudioFrameDecodedCallback& callback) = 0; 70 const AudioFrameDecodedCallback& callback) = 0;
69 virtual void RequestEncodedAudioFrame( 71 virtual void RequestEncodedAudioFrame(
70 const ReceiveEncodedFrameCallback& callback) = 0; 72 const ReceiveEncodedFrameCallback& callback) = 0;
71 virtual void RequestDecodedVideoFrame( 73 virtual void RequestDecodedVideoFrame(
72 const VideoFrameDecodedCallback& callback) = 0; 74 const VideoFrameDecodedCallback& callback) = 0;
73 virtual void RequestEncodedVideoFrame( 75 virtual void RequestEncodedVideoFrame(
74 const ReceiveEncodedFrameCallback& callback) = 0; 76 const ReceiveEncodedFrameCallback& callback) = 0;
75 77
76 virtual ~CastReceiver() {} 78 virtual ~CastReceiver() {}
77 }; 79 };
78 80
79 } // namespace cast 81 } // namespace cast
80 } // namespace media 82 } // namespace media
81 83
82 #endif // MEDIA_CAST_CAST_RECEIVER_H_ 84 #endif // MEDIA_CAST_CAST_RECEIVER_H_
OLDNEW
« no previous file with comments | « media/cast/cast_environment.cc ('k') | media/cast/cast_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698