diff options
Diffstat (limited to 'cast/standalone_receiver/sdl_player_base.h')
-rw-r--r-- | cast/standalone_receiver/sdl_player_base.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/cast/standalone_receiver/sdl_player_base.h b/cast/standalone_receiver/sdl_player_base.h index 365846db..2c2df38f 100644 --- a/cast/standalone_receiver/sdl_player_base.h +++ b/cast/standalone_receiver/sdl_player_base.h @@ -18,8 +18,8 @@ #include "platform/api/time.h" #include "platform/base/error.h" +namespace openscreen { namespace cast { -namespace streaming { // Common base class that consumes frames from a Receiver, decodes them, and // plays them out via the appropriate SDL subsystem. Subclasses implement the @@ -29,7 +29,7 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { ~SDLPlayerBase() override; // Returns OK unless a fatal error has occurred. - const openscreen::Error& error_status() const { return error_status_; } + const Error& error_status() const { return error_status_; } protected: // Current player state, which is used to determine what to render/present, @@ -43,7 +43,7 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { // A decoded frame and its target presentation time. struct PresentableFrame { - openscreen::Clock::time_point presentation_time; + Clock::time_point presentation_time; AVFrameUniquePtr decoded_frame; PresentableFrame(); @@ -55,8 +55,8 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { // |error_callback| is run only if a fatal error occurs, at which point the // player has halted and set |error_status()|. |media_type| should be "audio" // or "video" (only used when logging). - SDLPlayerBase(openscreen::ClockNowFunctionPtr now_function, - openscreen::TaskRunner* task_runner, + SDLPlayerBase(ClockNowFunctionPtr now_function, + TaskRunner* task_runner, Receiver* receiver, std::function<void()> error_callback, const char* media_type); @@ -68,7 +68,7 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { void OnFatalError(std::string message) final; // Renders the |frame| and returns its [possibly adjusted] presentation time. - virtual openscreen::ErrorOr<openscreen::Clock::time_point> RenderNextFrame( + virtual ErrorOr<Clock::time_point> RenderNextFrame( const PresentableFrame& frame) = 0; // Called to render when the player has no new content, and returns true if a @@ -108,13 +108,13 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { // require rendering/presenting a different output. void ResumeRendering(); - const openscreen::ClockNowFunctionPtr now_; + const ClockNowFunctionPtr now_; Receiver* const receiver_; std::function<void()> error_callback_; // Run once by OnFatalError(). const char* const media_type_; // For logging only. // Set to the error code that placed the player in a fatal error state. - openscreen::Error error_status_; + Error error_status_; // Current player state, which is used to determine what to render/present, // and how frequently. @@ -123,7 +123,7 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { // Queue of frames currently being decoded and decoded frames awaiting // rendering. struct PendingFrame : public PresentableFrame { - openscreen::Clock::time_point start_time; + Clock::time_point start_time; PendingFrame(); ~PendingFrame(); @@ -139,7 +139,7 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { // whenever the media (RTP) timestamps drift too much away from the rate at // which the local clock ticks. This is important for A/V synchronization. RtpTimeTicks last_sync_rtp_timestamp_{}; - openscreen::Clock::time_point last_sync_reference_time_{}; + Clock::time_point last_sync_reference_time_{}; Decoder decoder_; @@ -149,13 +149,13 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { // A cumulative moving average of recent single-frame processing times // (consume + decode + render). This is passed to the Cast Receiver so that it // can determine when to drop late frames. - openscreen::Clock::duration recent_processing_time_{}; + Clock::duration recent_processing_time_{}; // Alarms that execute the various stages of the player pipeline at certain // times. - openscreen::Alarm decode_alarm_; - openscreen::Alarm render_alarm_; - openscreen::Alarm presentation_alarm_; + Alarm decode_alarm_; + Alarm render_alarm_; + Alarm presentation_alarm_; // Maximum number of frames in the decode/render pipeline. This limit is about // making sure the player uses resources efficiently: It is better for frames @@ -164,7 +164,7 @@ class SDLPlayerBase : public Receiver::Consumer, public Decoder::Client { static constexpr int kMaxFramesInPipeline = 8; }; -} // namespace streaming } // namespace cast +} // namespace openscreen #endif // CAST_STANDALONE_RECEIVER_SDL_PLAYER_BASE_H_ |