cast_transport_host_filter.h revision cedac228d2dd51db4b79ea1e72c7f249408ee061
15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file.
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/id_map.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/time/default_tick_clock.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/common/cast_messages.h"
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/browser/browser_message_filter.h"
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "media/cast/cast_sender.h"
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "media/cast/logging/logging_defines.h"
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "media/cast/transport/cast_transport_sender.h"
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace cast {
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class CastTransportHostFilter : public content::BrowserMessageFilter {
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public:
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CastTransportHostFilter();
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private:
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual ~CastTransportHostFilter();
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void NotifyStatusChange(
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      media::cast::transport::CastTransportStatus result);
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void ReceivedPacket(
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      scoped_ptr<media::cast::transport::Packet> result);
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void RawEvents(int32 channel_id,
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                 const std::vector<media::cast::PacketEvent>& packet_events);
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // BrowserMessageFilter implementation.
34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Forwarding functions.
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void OnInitializeAudio(
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      int32 channel_id,
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const media::cast::transport::CastTransportAudioConfig& config);
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void OnInitializeVideo(
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      int32 channel_id,
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const media::cast::transport::CastTransportVideoConfig& config);
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void OnInsertCodedAudioFrame(
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
45cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const media::cast::transport::EncodedFrame& audio_frame);
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void OnInsertCodedVideoFrame(
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
48cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const media::cast::transport::EncodedFrame& video_frame);
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void OnSendRtcpFromRtpSender(
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      const media::cast::transport::SendRtcpFromRtpSenderData& data,
52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const media::cast::transport::RtcpDlrrReportBlock& dlrr);
535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void OnResendPackets(
545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      bool is_audio,
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      const media::cast::MissingFramesAndPacketsMap& missing_packets);
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void OnNew(
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      int32 channel_id,
59effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch      const net::IPEndPoint& remote_end_point);
605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void OnDelete(int32 channel_id);
615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  IDMap<media::cast::transport::CastTransportSender, IDMapOwnPointer> id_map_;
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Clock used by Cast transport.
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  base::DefaultTickClock clock_;
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter);
685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)};
695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}  // namespace cast
715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif  // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_
73