| OLD | NEW |
| 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 #ifndef CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_ |
| 6 #define CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_ | 6 #define CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "media/cast/cast_config.h" | 16 #include "media/cast/cast_config.h" |
| 17 #include "media/cast/constants.h" | 17 #include "media/cast/constants.h" |
| 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class DictionaryValue; | 21 class DictionaryValue; |
| 22 class Value; | 22 class Value; |
| 23 using BinaryValue = Value; | |
| 24 } | 23 } |
| 25 | 24 |
| 26 class CastAudioSink; | 25 class CastAudioSink; |
| 27 class CastSession; | 26 class CastSession; |
| 28 class CastVideoSink; | 27 class CastVideoSink; |
| 29 | 28 |
| 30 // This object represents a RTP stream that encodes and optionally | 29 // This object represents a RTP stream that encodes and optionally |
| 31 // encrypt audio or video data from a WebMediaStreamTrack. | 30 // encrypt audio or video data from a WebMediaStreamTrack. |
| 32 // Note that this object does not actually output packets. It allows | 31 // Note that this object does not actually output packets. It allows |
| 33 // configuration of encoding and RTP parameters and control such a logical | 32 // configuration of encoding and RTP parameters and control such a logical |
| (...skipping 28 matching lines...) Expand all Loading... |
| 62 | 61 |
| 63 // Stop encoding. | 62 // Stop encoding. |
| 64 void Stop(); | 63 void Stop(); |
| 65 | 64 |
| 66 // Enables or disables logging for this stream. | 65 // Enables or disables logging for this stream. |
| 67 void ToggleLogging(bool enable); | 66 void ToggleLogging(bool enable); |
| 68 | 67 |
| 69 // Get serialized raw events for this stream with |extra_data| attached, | 68 // Get serialized raw events for this stream with |extra_data| attached, |
| 70 // and invokes |callback| with the result. | 69 // and invokes |callback| with the result. |
| 71 void GetRawEvents( | 70 void GetRawEvents( |
| 72 const base::Callback<void(std::unique_ptr<base::BinaryValue>)>& callback, | 71 const base::Callback<void(std::unique_ptr<base::Value>)>& callback, |
| 73 const std::string& extra_data); | 72 const std::string& extra_data); |
| 74 | 73 |
| 75 // Get stats in DictionaryValue format and invokves |callback| with | 74 // Get stats in DictionaryValue format and invokves |callback| with |
| 76 // the result. | 75 // the result. |
| 77 void GetStats(const base::Callback< | 76 void GetStats(const base::Callback< |
| 78 void(std::unique_ptr<base::DictionaryValue>)>& callback); | 77 void(std::unique_ptr<base::DictionaryValue>)>& callback); |
| 79 | 78 |
| 80 private: | 79 private: |
| 81 void DidEncounterError(const std::string& message); | 80 void DidEncounterError(const std::string& message); |
| 82 | 81 |
| 83 blink::WebMediaStreamTrack track_; | 82 blink::WebMediaStreamTrack track_; |
| 84 const scoped_refptr<CastSession> cast_session_; | 83 const scoped_refptr<CastSession> cast_session_; |
| 85 std::unique_ptr<CastAudioSink> audio_sink_; | 84 std::unique_ptr<CastAudioSink> audio_sink_; |
| 86 std::unique_ptr<CastVideoSink> video_sink_; | 85 std::unique_ptr<CastVideoSink> video_sink_; |
| 87 base::Closure stop_callback_; | 86 base::Closure stop_callback_; |
| 88 ErrorCallback error_callback_; | 87 ErrorCallback error_callback_; |
| 89 bool is_audio_; | 88 bool is_audio_; |
| 90 | 89 |
| 91 base::WeakPtrFactory<CastRtpStream> weak_factory_; | 90 base::WeakPtrFactory<CastRtpStream> weak_factory_; |
| 92 | 91 |
| 93 DISALLOW_COPY_AND_ASSIGN(CastRtpStream); | 92 DISALLOW_COPY_AND_ASSIGN(CastRtpStream); |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 #endif // CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_ | 95 #endif // CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_ |
| OLD | NEW |