AFAIK chromecast不支持RTP,但是当我将我的一加一连接到chromecast时,我得到了以下日志,那么它是如何投射的?
yourVideoElement.srcObject
更新
关于Ali Naddaf回答我的问题是,我的想法是一样的,但是当你使用mediacodec和muxer api录制视频时,它的moov原子不会写在文件的开头,因此在录制完成之前无法播放(即无法流式传输),然后内置应用程序如何同时创建和流式传输,如果您检查日志,它会大量提及RTP关键字是什么?
我之前使用muxer询问了创建文件的问题,但答案并不令人满意BTW这里是上一个问题链接
还试过Presentation API演示,但它崩溃了 https://github.com/googlecast/CastRemoteDisplay-android
编辑,因为这些演示文稿演示无效,演示将不适用于09-15 16:07:37.648 815-815/? I/MediaRouterService: Selected global route:Route cast409 (com.google.android.gms/.cast.media.CastRemoteDisplayProviderService:c5d0e5d940851c488853a91b1635cfde)
09-15 16:07:37.659 255-2209/? W/APM::AudioPolicyManager: releaseOutput() releasing unknown output 320
09-15 16:07:37.661 815-837/? D/WifiService: acquireWifiLockLocked: WifiLock{CastMediaRouteProvider type=1 binder=android.os.BinderProxy@5381e83}
09-15 16:07:37.661 815-2665/? E/native: do suspend false
09-15 16:07:37.661 815-1554/? I/WifiDisplayController: Stopping Wifi display scan.
09-15 16:07:37.662 2694-2694/? I/wpa_supplicant: P2P-FIND-STOPPED
09-15 16:07:37.663 815-815/? I/MediaRouterService: Connecting to global route: Route cast409 (com.google.android.gms/.cast.media.CastRemoteDisplayProviderService:c5d0e5d940851c488853a91b1635cfde)
09-15 16:07:37.664 3028-3028/? D/ChimeraResource: Successfully parsed resource with package name: com.google.android.gms and resource name drawable/ic_notification_cast_connecting
09-15 16:07:37.669 255-2211/? D/audio_hw_primary: out_set_parameters: enter: usecase(4: audio-ull-playback) kvpairs: routing=2
09-15 16:07:37.679 255-2211/? D/audio_hw_primary: start_output_stream: enter: stream(0xb5fb6fc0)usecase(4: audio-ull-playback) devices(0x2)
09-15 16:07:37.679 255-2211/? D/audio_hw_primary: start_output_stream: enter: usecase(4: audio-ull-playback) devices(0x2)
09-15 16:07:37.679 255-2211/? E/audio_hw_primary: voice_extn_compress_voip_is_active: COMPRESS_VOIP_ENABLED is not defined
09-15 16:07:37.679 255-2211/? E/msm8974_platform: voice_extn_compress_voip_is_active: COMPRESS_VOIP_ENABLED is not defined
09-15 16:07:37.680 255-2211/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: )
09-15 16:07:37.680 255-2211/? W/msm8974_platform: Codec backend bitwidth 16, samplerate 48000
09-15 16:07:37.680 255-2211/? D/hardware_info: hw_info_append_hw_type : device_name = speaker
09-15 16:07:37.680 255-2211/? I/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 15, path = 0
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_adm_topology
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_asm_topology
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_audtable
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_audvoltable
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE
[ 09-15 16:07:37.680 255: 2211 D/ ]
Failed to fetch the lookup information of the device 0000000F
09-15 16:07:37.680 255-2211/? E/ACDB-LOADER: Error: ACDB AudProc vol returned = -19
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_afe_cal
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE
[ 09-15 16:07:37.680 255: 2211 D/ ]
Failed to fetch the lookup information of the device 0000000F
09-15 16:07:37.680 255-2211/? E/ACDB-LOADER: Error: ACDB AFE returned = -19
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL
09-15 16:07:37.686 255-2211/? D/audio_hw_primary: select_devices: done
09-15 16:07:37.837 3028-13759/? I/CastDeviceController: [controller-0006 MRP] calling Listener.onConnected(true)
09-15 16:07:37.845 3028-13759/? I/CastDeviceController: [controller-0006 MRP] launchApplicationInternal. id=674A0243, options=LaunchOptions(relaunchIfRunning=true, language=en-US)
09-15 16:07:37.845 4374-4518/? D/DeviceConnectionService: client connected with version: 9452000
09-15 16:07:38.216 3028-4268/? I/CastMediaRouteProvider: CastDeviceController.Listener.onApplicationConnected: appId=674A0243, sessionId=729D062D-A72C-4D5A-92FA-84CAEE580C8F
09-15 16:07:38.219 3028-3028/? I/MirroringControlChannel: [instance-6] offer string; {"udpPort":2346,"supportedStreams":[{"index":0,"type":"audio_source","codecName":"aac","rtpProfile":"cast","rtpPayloadType":127,"ssrc":1,"storeTime":100,"targetDelay":100,"bitRate":128000,"sampleRate":48000,"timeBase":"1\/48000","channels":2,"rtpExtensions":["adaptive_playout_delay"],"receiverRtcpEventLog":true,"aesKey":"33ef675ea7ce18414c584ecdcfc4b442","aesIvMask":"216e2d585125e768cb6ede391a7b21f8","errorRecoveryMode":"castv2"},{"index":1,"type":"video_source","codecName":"h264","rtpProfile":"cast","rtpPayloadType":96,"ssrc":11,"storeTime":100,"targetDelay":100,"maxFrameRate":"60000\/1001","timeBase":"1\/90000","maxBitRate":6000000,"profile":"main","level":"4","resolutions":[{"height":720,"width":1280}],"rtpExtensions":["adaptive_playout_delay"],"receiverRtcpEventLog":true,"aesKey":"33ef675ea7ce18414c584ecdcfc4b442","aesIvMask":"216e2d585125e768cb6ede391a7b21f8","errorRecoveryMode":"castv2","intraRefreshEnable":false}]}
09-15 16:07:38.454 3028-3028/? W/CastRouteController: [instance-6] createSourceOrSink, flags = 0x80000000
09-15 16:07:38.455 3028-27897/? I/JGCastService: enable TDLS on source
09-15 16:07:38.456 3028-27897/? I/GCastSource: config = '
09-15 16:07:38.457 3028-27897/? I/GCastSource: {
09-15 16:07:38.457 3028-27897/? I/GCastSource: "extraData": {
09-15 16:07:38.457 3028-27897/? I/GCastSource: "maxBitrate": 6000,
09-15 16:07:38.457 3028-27897/? I/GCastSource: "maxFramerate": "60000\/1001",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "minLatency": 100,
09-15 16:07:38.457 3028-27897/? I/GCastSource: "receiverProductName": "Chromecast",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "receiverVersion": "5",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "resolution": "1280x720",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "senderBuild": "MHC19Q",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "senderGmsCoreVersion": 9452000,
09-15 16:07:38.457 3028-27897/? I/GCastSource: "senderModel": "A0001",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "senderPlatform": "Android",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "senderVersion": "6.0.1"
09-15 16:07:38.457 3028-27897/? I/GCastSource: },
09-15 16:07:38.457 3028-27897/? I/GCastSource: "maxTargetDelay": 500,
09-15 16:07:38.457 3028-27897/? I/GCastSource: "remoteFriendlyName": "cast409",
09-15 16:07:38.457 3028-27897/? I/GCastSource: "sendFormats": [
09-15 16:07:38.457 3028-27897/? I/GCastSource: {
09-15 16:07:38.457 3028-27897/? I/GCastSource: "aes-iv-mask": [redacted],
09-15 16:07:38.457 3028-27897/? I/GCastSource: "aes-key": [redacted],
09-15 16:07:38.458 3028-27897/? I/GCastSource: "bit_rate": 128000,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "channels": 2,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "codec_name": "aac_ld_adts",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "index": 0,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "receiver_events": true,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "remote_rtp_port": 49794,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "remote_ssrc": 2,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_extensions": [
09-15 16:07:38.458 3028-27897/? I/GCastSource: "adaptive_playout_delay"
09-15 16:07:38.458 3028-27897/? I/GCastSource: ],
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_payload_type": 127,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_port": 2346,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_profile": "cast",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "sample_rate": 48000,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "ssrc": 1,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "store_time": 100,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "time_base": 48000,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "type": "audio_source"
09-15 16:07:38.458 3028-27897/? I/GCastSource: },
09-15 16:07:38.458 3028-27897/? I/GCastSource: {
09-15 16:07:38.458 3028-27897/? I/GCastSource: "aes-iv-mask": [redacted],
09-15 16:07:38.458 3028-27897/? I/GCastSource: "aes-key": [redacted],
09-15 16:07:38.458 3028-27897/? I/GCastSource: "codec_name": "h264",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "error_recovery_mode": "castv2",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "index": 1,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "key_frame_refresh_interval": 60,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "max_bit_rate": 6000000,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "max_frame_rate": "60000\/1001",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "receiver_events": true,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "remote_rtp_port": 49794,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "remote_ssrc": 12,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "resolutions": [
09-15 16:07:38.458 3028-27897/? I/GCastSource: {
09-15 16:07:38.458 3028-27897/? I/GCastSource: "height": 720,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "width": 1280
09-15 16:07:38.458 3028-27897/? I/GCastSource: }
09-15 16:07:38.458 3028-27897/? I/GCastSource: ],
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_extensions": [
09-15 16:07:38.458 3028-27897/? I/GCastSource: "adaptive_playout_delay"
09-15 16:07:38.458 3028-27897/? I/GCastSource: ],
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_payload_type": 96,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_port": 2346,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "rtp_profile": "cast",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "ssrc": 11,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "store_time": 100,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "time_base": 90000,
09-15 16:07:38.458 3028-27897/? I/GCastSource: "type": "video_source",
09-15 16:07:38.458 3028-27897/? I/GCastSource: "use_intra_macroblock_cyclic_mode": false
09-15 16:07:38.458 3028-27897/? I/GCastSource: }
09-15 16:07:38.458 3028-27897/? I/GCastSource: ]
09-15 16:07:38.458 3028-27897/? I/GCastSource: }
09-15 16:07:38.458 3028-27897/? I/GCastSource: '
09-15 16:07:38.458 3028-27897/? I/GCastSource: Connecting to receiver: cast409
09-15 16:07:38.458 3028-27897/? I/GCastSource: increasing video delay to 100 ms, max unacked 6
09-15 16:07:38.459 3028-27897/? I/GCastSource: encrypting video.
09-15 16:07:38.459 3028-27897/? I/GCastSource: Using ADTS
09-15 16:07:38.459 3028-27897/? I/GCastSource: increasing audio delay to 100 ms, max unacked 16
09-15 16:07:38.459 3028-27897/? I/GCastSource: encrypting audio.
09-15 16:07:38.459 3028-27897/? I/GCastSource: connecting RTP from 0.0.0.0:2346 to 192.168.1.6:49794
09-15 16:07:38.459 3028-27897/? I/NetworkSession: socket 134 listening to 0.0.0.0:2346
09-15 16:07:38.460 2694-2694/? I/wpa_supplicant: TDLS: Failed to send message (action_code=10)
09-15 16:07:38.461 2694-2694/? I/wpa_supplicant: TDLS: Creating peer entry for 6c:ad:f8:8b:d0:26
09-15 16:07:38.463 3028-27897/? I/Converter: initEncoder, mOutputFormat - AMessage(what = 0x00000000) = {
string error_recovery_mode = "castv2"
int32_t use_intra_macroblock_cyclic_mode = 0
string mime = "video/avc"
int32_t key_frame_refresh_interval = 60
int32_t width = 1280
int32_t height = 720
int32_t max-bitrate = 6000000
float max-fps-to-encoder = 59.940060
int32_t bitrate = 3000000
int32_t store-metadata-in-buffers = 1
int32_t color-format = 2130708361
int64_t repeat-previous-frame-after = 70000
int64_t max-pts-gap-to-encoder = 33333
}
09-15 16:07:38.466 3028-27901/? I/OMXClient: Using client-side OMX mux.
09-15 16:07:38.470 3028-27897/? I/Converter: using video bitrate of 3000000 bps
09-15 16:07:38.470 3028-27897/? I/Converter: Optmized for quality/video - not using IntraRefreshCyclic
09-15 16:07:38.471 255-12601/? E/OMXNodeInstance: getParameter(55:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
09-15 16:07:38.472 255-2219/? W/OMXNodeInstance: [55:qcom.encoder.avc] component does not support metadata mode; using fallback
09-15 16:07:38.472 3028-27901/? E/ACodec: [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -1010
09-15 16:07:38.472 3028-27901/? W/ACodec: do not know color format 0x7fa30c04 = 2141391876
09-15 16:07:38.472 3028-27901/? W/ACodec: do not know color format 0x7f000789 = 2130708361
09-15 16:07:38.474 3028-27901/? I/FFMPEGSoftCodec: Decoder will be in frame by frame mode
09-15 16:07:38.477 3028-27901/? I/ACodec: setupVideoEncoder succeeded
09-15 16:07:38.478 3028-27901/? W/ACodec: do not know color format 0x7f000789 = 2130708361
09-15 16:07:38.482 255-2219/? E/OMXNodeInstance: getParameter(55:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
09-15 16:07:38.494 255-255/? D/r_submix: adev_open_input_stream(addr=0)
09-15 16:07:38.495 255-255/? D/r_submix: Non-NULL shut down sink when opening input stream, releasing, refcount=4
09-15 16:07:38.495 255-255/? D/r_submix: submix_audio_device_release_pipe_l(idx=9) addr=0
09-15 16:07:38.495 255-255/? D/r_submix: submix_audio_device_create_pipe_l(addr=0, idx=9)
09-15 16:07:38.495 255-255/? D/r_submix: now using address 0 for route 9
09-15 16:07:38.495 255-27909/? I/AudioFlinger: AudioFlinger's thread 0xad940000 ready to run
09-15 16:07:38.495 255-27909/? I/r_submix: in_standby()
09-15 16:07:38.496 255-27909/? I/r_submix: in_standby()
09-15 16:07:38.498 3028-27897/? I/Converter: initEncoder, mOutputFormat - AMessage(what = 0x00000000) = {
string mime = "audio/mp4a-latm"
int32_t sample-rate = 48000
int32_t channel-count = 2
int32_t bitrate = 128000
int32_t max-input-size = 7680
}
09-15 16:07:38.499 3028-27910/? I/OMXClient: Using client-side OMX mux.
09-15 16:07:38.579 3028-27897/? I/Converter: using audio bitrate of 128000 bps
09-15 16:07:38.583 255-12601/? I/AudioFlinger: openOutput(), module 12 Device 8000, SamplingRate 48000, Format 0x000001, Channels 3, flags 0
09-15 16:07:38.583 255-12601/? D/r_submix: adev_open_output_stream(address=0)
09-15 16:07:38.583 255-12601/? D/r_submix: submix_audio_device_create_pipe_l(addr=0, idx=9)
09-15 16:07:38.583 255-12601/? D/r_submix: now using address 0 for route 9
09-15 16:07:38.583 255-12601/? I/AudioFlinger: AudioStreamOut::open(), mHalFormatIsLinearPcm = 1
09-15 16:07:38.583 255-12601/? I/AudioFlinger: HAL output buffer size 1024 frames, normal sink buffer size 1024 frames
09-15 16:07:38.584 255-27918/? I/AudioFlinger: AudioFlinger's thread 0xadb40000 ready to run
09-15 16:07:38.585 255-27918/? I/r_submix: out_standby()
09-15 16:07:38.587 255-12601/? I/AudioFlinger: HAL output buffer size 1024 frames, normal sink buffer size 1024 frames
09-15 16:07:38.588 255-27919/? I/AudioFlinger: AudioFlinger's thread 0xadbc0000 ready to run
09-15 16:07:38.597 255-2208/? D/audio_hw_primary: adev_set_parameters: enter: 0=;connect=32768
09-15 16:07:38.597 255-2208/? E/voice: voice_extn_compress_voip_set_parameters: COMPRESS_VOIP_ENABLED is not defined
09-15 16:07:38.597 255-2208/? E/bt_a2dp_hw: adev_set_parameters: ERROR: set param called even when stream out is null
09-15 16:07:38.599 815-4743/? I/DisplayManagerService: Display device added: DisplayDeviceInfo{"cast409": uniqueId="virtual:com.google.android.gms,10018,cast409,0", 1280 x 720, modeId 7, defaultModeId 7, supportedModes [{id=7, width=1280, height=720, fps=60.0}], colorTransformId 0, defaultColorTransformId 0, supportedColorTransforms [], density 213, 213.0 x 213.0 dpi, appVsyncOff 0, presDeadline 16666666, touch NONE, rotation 0, type VIRTUAL, state ON, owner com.google.android.gms (uid 10018), FLAG_SECURE, FLAG_PRESENTATION}
09-15 16:07:38.606 815-3564/? D/WifiService: acquireWifiLockLocked: WifiLock{CastMirroringProvider type=1 binder=android.os.BinderProxy@7d24f56}
09-15 16:07:38.607 3028-3028/? D/CastMirroringProvider: No Notifier
09-15 16:07:38.607 815-2665/? E/native: do suspend false
09-15 16:07:38.607 815-3560/? D/WifiService: acquireWifiLockLocked: WifiLock{CastRemoteDisplayProvider type=1 binder=android.os.BinderProxy@b3c2bd7}
09-15 16:07:38.607 815-2665/? E/native: do suspend false
09-15 16:07:38.608 3028-3028/? D/ChimeraResource: Successfully parsed resource with package name: com.google.android.gms and resource name drawable/ic_notification_cast_on
09-15 16:07:38.608 815-815/? I/MediaRouterService: Connected to global route: Route cast409 (com.google.android.gms/.cast.media.CastRemoteDisplayProviderService:c5d0e5d940851c488853a91b1635cfde)
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: EGL information:
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: vendor : Android
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: version : 1.4 Android META-EGL
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: extensions: EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time EGL_KHR_swap_buffers_with_damage EGL_KHR_image EGL_KHR_image_base EGL_KHR_lock_surface EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync EGL_KHR_create_context EGL_EXT_create_context_robustness EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_recordable EGL_KHR_partial_update
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: Client API: OpenGL_ES
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: EGLSurface: 8-8-8-8, config=0x5
09-15 16:07:38.643 3028-27897/? I/GCastBase: updating NTP offset, accuracy +/- 2931 us
答案 0 :(得分:-2)
Chromecast不支持RTP。
您可以使用RemoteDiaplay API,如日志所示,它基本上“镜像”从您的应用程序到chromecast的视图,但在那种情况下,从chromecast的角度来看,它基本上是在播放电影(您的手机已编码)并从指定的视图放在一起,并流式传输到chromecast)。同样,chromecast本身不支持RTP