Home | History | Annotate | Download | only in common
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // IPC messages for the Cast transport API.
      6 // Multiply-included message file, hence no include guard.
      7 
      8 #include "ipc/ipc_message_macros.h"
      9 #include "media/cast/cast_sender.h"
     10 #include "media/cast/logging/logging_defines.h"
     11 #include "media/cast/net/cast_transport_sender.h"
     12 #include "media/cast/net/rtcp/rtcp_defines.h"
     13 #include "net/base/ip_endpoint.h"
     14 
     15 #undef IPC_MESSAGE_EXPORT
     16 #define IPC_MESSAGE_EXPORT
     17 #define IPC_MESSAGE_START CastMsgStart
     18 
     19 IPC_ENUM_TRAITS_MAX_VALUE(
     20     media::cast::EncodedFrame::Dependency,
     21     media::cast::EncodedFrame::DEPENDENCY_LAST)
     22 IPC_ENUM_TRAITS_MAX_VALUE(media::cast::Codec,
     23                           media::cast::CODEC_LAST)
     24 IPC_ENUM_TRAITS_MAX_VALUE(media::cast::CastTransportStatus,
     25                           media::cast::CAST_TRANSPORT_STATUS_LAST)
     26 IPC_ENUM_TRAITS_MAX_VALUE(media::cast::CastLoggingEvent,
     27                           media::cast::kNumOfLoggingEvents)
     28 IPC_ENUM_TRAITS_MAX_VALUE(media::cast::EventMediaType,
     29                           media::cast::EVENT_MEDIA_TYPE_LAST)
     30 
     31 IPC_STRUCT_TRAITS_BEGIN(media::cast::EncodedFrame)
     32   IPC_STRUCT_TRAITS_MEMBER(dependency)
     33   IPC_STRUCT_TRAITS_MEMBER(frame_id)
     34   IPC_STRUCT_TRAITS_MEMBER(referenced_frame_id)
     35   IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
     36   IPC_STRUCT_TRAITS_MEMBER(reference_time)
     37   IPC_STRUCT_TRAITS_MEMBER(new_playout_delay_ms)
     38   IPC_STRUCT_TRAITS_MEMBER(data)
     39 IPC_STRUCT_TRAITS_END()
     40 
     41 IPC_STRUCT_TRAITS_BEGIN(media::cast::RtcpDlrrReportBlock)
     42   IPC_STRUCT_TRAITS_MEMBER(last_rr)
     43   IPC_STRUCT_TRAITS_MEMBER(delay_since_last_rr)
     44 IPC_STRUCT_TRAITS_END()
     45 
     46 IPC_STRUCT_TRAITS_BEGIN(media::cast::CastTransportRtpConfig)
     47   IPC_STRUCT_TRAITS_MEMBER(ssrc)
     48   IPC_STRUCT_TRAITS_MEMBER(feedback_ssrc)
     49   IPC_STRUCT_TRAITS_MEMBER(rtp_payload_type)
     50   IPC_STRUCT_TRAITS_MEMBER(aes_key)
     51   IPC_STRUCT_TRAITS_MEMBER(aes_iv_mask)
     52 IPC_STRUCT_TRAITS_END()
     53 
     54 IPC_STRUCT_TRAITS_BEGIN(media::cast::PacketEvent)
     55   IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
     56   IPC_STRUCT_TRAITS_MEMBER(frame_id)
     57   IPC_STRUCT_TRAITS_MEMBER(max_packet_id)
     58   IPC_STRUCT_TRAITS_MEMBER(packet_id)
     59   IPC_STRUCT_TRAITS_MEMBER(size)
     60   IPC_STRUCT_TRAITS_MEMBER(timestamp)
     61   IPC_STRUCT_TRAITS_MEMBER(type)
     62   IPC_STRUCT_TRAITS_MEMBER(media_type)
     63 IPC_STRUCT_TRAITS_END()
     64 
     65 IPC_STRUCT_TRAITS_BEGIN(media::cast::FrameEvent)
     66   IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
     67   IPC_STRUCT_TRAITS_MEMBER(frame_id)
     68   IPC_STRUCT_TRAITS_MEMBER(size)
     69   IPC_STRUCT_TRAITS_MEMBER(timestamp)
     70   IPC_STRUCT_TRAITS_MEMBER(type)
     71   IPC_STRUCT_TRAITS_MEMBER(media_type)
     72   IPC_STRUCT_TRAITS_MEMBER(delay_delta)
     73   IPC_STRUCT_TRAITS_MEMBER(key_frame)
     74   IPC_STRUCT_TRAITS_MEMBER(target_bitrate)
     75 IPC_STRUCT_TRAITS_END()
     76 
     77 IPC_STRUCT_TRAITS_BEGIN(media::cast::RtcpCastMessage)
     78   IPC_STRUCT_TRAITS_MEMBER(media_ssrc)
     79   IPC_STRUCT_TRAITS_MEMBER(ack_frame_id)
     80   IPC_STRUCT_TRAITS_MEMBER(target_delay_ms)
     81   IPC_STRUCT_TRAITS_MEMBER(missing_frames_and_packets)
     82 IPC_STRUCT_TRAITS_END()
     83 
     84 // Cast messages sent from the browser to the renderer.
     85 
     86 IPC_MESSAGE_CONTROL3(CastMsg_Rtt,
     87                      int32 /* channel_id */,
     88                      uint32 /* ssrc */,
     89                      base::TimeDelta /* rtt */)
     90 
     91 IPC_MESSAGE_CONTROL3(CastMsg_RtcpCastMessage,
     92                      int32 /* channel_id */,
     93                      uint32 /* ssrc */,
     94                      media::cast::RtcpCastMessage /* cast_message */)
     95 
     96 IPC_MESSAGE_CONTROL2(
     97     CastMsg_NotifyStatusChange,
     98     int32 /* channel_id */,
     99     media::cast::CastTransportStatus /* status */)
    100 
    101 IPC_MESSAGE_CONTROL3(CastMsg_RawEvents,
    102                      int32 /* channel_id */,
    103                      std::vector<media::cast::PacketEvent> /* packet_events */,
    104                      std::vector<media::cast::FrameEvent> /* frame_events */)
    105 
    106 // Cast messages sent from the renderer to the browser.
    107 
    108 IPC_MESSAGE_CONTROL2(
    109   CastHostMsg_InitializeAudio,
    110   int32 /*channel_id*/,
    111   media::cast::CastTransportRtpConfig /*config*/)
    112 
    113 IPC_MESSAGE_CONTROL2(
    114   CastHostMsg_InitializeVideo,
    115   int32 /*channel_id*/,
    116   media::cast::CastTransportRtpConfig /*config*/)
    117 
    118 IPC_MESSAGE_CONTROL3(
    119     CastHostMsg_InsertFrame,
    120     int32 /* channel_id */,
    121     uint32 /* ssrc */,
    122     media::cast::EncodedFrame /* audio/video frame */)
    123 
    124 IPC_MESSAGE_CONTROL4(
    125     CastHostMsg_SendSenderReport,
    126     int32 /* channel_id */,
    127     uint32 /* ssrc */,
    128     base::TimeTicks /* current_time */,
    129     uint32 /* current_time_as_rtp_timestamp */)
    130 
    131 IPC_MESSAGE_CONTROL3(
    132     CastHostMsg_CancelSendingFrames,
    133     int32 /* channel_id */,
    134     uint32 /* ssrc */,
    135     std::vector<uint32> /* frame_ids */)
    136 
    137 IPC_MESSAGE_CONTROL3(
    138     CastHostMsg_ResendFrameForKickstart,
    139     int32 /* channel_id */,
    140     uint32 /* ssrc */,
    141     uint32 /* frame_id */)
    142 
    143 IPC_MESSAGE_CONTROL3(
    144     CastHostMsg_New,
    145     int32 /* channel_id */,
    146     net::IPEndPoint /* remote_end_point */,
    147     base::DictionaryValue /* options */)
    148 
    149 IPC_MESSAGE_CONTROL1(
    150     CastHostMsg_Delete,
    151     int32 /* channel_id */)
    152