├── README.md └── clientAndroid ├── AACPlayer ├── .gitignore ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── gradle.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── vcs.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── aacplayer │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ │ └── test.aac │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── aacplayer │ │ │ │ ├── AudioTrackRender.java │ │ │ │ └── MainActivity.java │ │ ├── jni │ │ │ ├── AACFileparser.cpp │ │ │ ├── AACFileparser.h │ │ │ ├── AACMediacodecDecoder.cpp │ │ │ ├── AACMediacodecDecoder.h │ │ │ ├── Android.mk │ │ │ ├── AudioTrackRender_jni.cpp │ │ │ ├── IAudioRender.h │ │ │ ├── JavaAudioTrackRender.cpp │ │ │ ├── JavaAudioTrackRender.h │ │ │ ├── Logs.h │ │ │ ├── Utils.cpp │ │ │ └── Utils.h │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── themes.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── aacplayer │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle └── live555 ├── .gitignore ├── .idea ├── .gitignore ├── compiler.xml ├── encodings.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml └── vcs.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── live555 │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── test.264 │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── live555 │ │ │ ├── MainActivity.java │ │ │ └── live555player.java │ ├── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ ├── MediaBuffer.cpp │ │ ├── MediaBuffer.h │ │ ├── MediaQueue.cpp │ │ ├── MediaQueue.h │ │ ├── Render │ │ │ ├── OboeRender.cpp │ │ │ └── OboeRender.h │ │ ├── VideoDecoderInterface.h │ │ ├── base │ │ │ ├── CHandler.cpp │ │ │ ├── CHandler.h │ │ │ ├── CLooper.cpp │ │ │ ├── CLooper.h │ │ │ ├── CLooperRoster.cpp │ │ │ ├── CLooperRoster.h │ │ │ ├── CMessage.cpp │ │ │ ├── CMessage.h │ │ │ ├── Errors.h │ │ │ └── test │ │ │ │ └── LooperTest.cpp │ │ ├── live555 │ │ │ ├── arm64-v8a │ │ │ │ └── usr │ │ │ │ │ └── local │ │ │ │ │ ├── include │ │ │ │ │ ├── BasicUsageEnvironment │ │ │ │ │ │ ├── BasicHashTable.hh │ │ │ │ │ │ ├── BasicUsageEnvironment.hh │ │ │ │ │ │ ├── BasicUsageEnvironment0.hh │ │ │ │ │ │ ├── BasicUsageEnvironment_version.hh │ │ │ │ │ │ ├── DelayQueue.hh │ │ │ │ │ │ └── HandlerSet.hh │ │ │ │ │ ├── UsageEnvironment │ │ │ │ │ │ ├── Boolean.hh │ │ │ │ │ │ ├── HashTable.hh │ │ │ │ │ │ ├── UsageEnvironment.hh │ │ │ │ │ │ ├── UsageEnvironment_version.hh │ │ │ │ │ │ └── strDup.hh │ │ │ │ │ ├── groupsock │ │ │ │ │ │ ├── GroupEId.hh │ │ │ │ │ │ ├── Groupsock.hh │ │ │ │ │ │ ├── GroupsockHelper.hh │ │ │ │ │ │ ├── IOHandlers.hh │ │ │ │ │ │ ├── NetAddress.hh │ │ │ │ │ │ ├── NetCommon.h │ │ │ │ │ │ ├── NetInterface.hh │ │ │ │ │ │ └── groupsock_version.hh │ │ │ │ │ └── liveMedia │ │ │ │ │ │ ├── AC3AudioFileServerMediaSubsession.hh │ │ │ │ │ │ ├── AC3AudioRTPSink.hh │ │ │ │ │ │ ├── AC3AudioRTPSource.hh │ │ │ │ │ │ ├── AC3AudioStreamFramer.hh │ │ │ │ │ │ ├── ADTSAudioFileServerMediaSubsession.hh │ │ │ │ │ │ ├── ADTSAudioFileSource.hh │ │ │ │ │ │ ├── ADTSAudioStreamDiscreteFramer.hh │ │ │ │ │ │ ├── AMRAudioFileServerMediaSubsession.hh │ │ │ │ │ │ ├── AMRAudioFileSink.hh │ │ │ │ │ │ ├── AMRAudioFileSource.hh │ │ │ │ │ │ ├── AMRAudioRTPSink.hh │ │ │ │ │ │ ├── AMRAudioRTPSource.hh │ │ │ │ │ │ ├── AMRAudioSource.hh │ │ │ │ │ │ ├── AVIFileSink.hh │ │ │ │ │ │ ├── AudioInputDevice.hh │ │ │ │ │ │ ├── AudioRTPSink.hh │ │ │ │ │ │ ├── Base64.hh │ │ │ │ │ │ ├── BasicUDPSink.hh │ │ │ │ │ │ ├── BasicUDPSource.hh │ │ │ │ │ │ ├── BitVector.hh │ │ │ │ │ │ ├── ByteStreamFileSource.hh │ │ │ │ │ │ ├── ByteStreamMemoryBufferSource.hh │ │ │ │ │ │ ├── ByteStreamMultiFileSource.hh │ │ │ │ │ │ ├── DVVideoFileServerMediaSubsession.hh │ │ │ │ │ │ ├── DVVideoRTPSink.hh │ │ │ │ │ │ ├── DVVideoRTPSource.hh │ │ │ │ │ │ ├── DVVideoStreamFramer.hh │ │ │ │ │ │ ├── DeviceSource.hh │ │ │ │ │ │ ├── DigestAuthentication.hh │ │ │ │ │ │ ├── FileServerMediaSubsession.hh │ │ │ │ │ │ ├── FileSink.hh │ │ │ │ │ │ ├── FramedFileSource.hh │ │ │ │ │ │ ├── FramedFilter.hh │ │ │ │ │ │ ├── FramedSource.hh │ │ │ │ │ │ ├── GSMAudioRTPSink.hh │ │ │ │ │ │ ├── GenericMediaServer.hh │ │ │ │ │ │ ├── H261VideoRTPSource.hh │ │ │ │ │ │ ├── H263plusVideoFileServerMediaSubsession.hh │ │ │ │ │ │ ├── H263plusVideoRTPSink.hh │ │ │ │ │ │ ├── H263plusVideoRTPSource.hh │ │ │ │ │ │ ├── H263plusVideoStreamFramer.hh │ │ │ │ │ │ ├── H264VideoFileServerMediaSubsession.hh │ │ │ │ │ │ ├── H264VideoFileSink.hh │ │ │ │ │ │ ├── H264VideoRTPSink.hh │ │ │ │ │ │ ├── H264VideoRTPSource.hh │ │ │ │ │ │ ├── H264VideoStreamDiscreteFramer.hh │ │ │ │ │ │ ├── H264VideoStreamFramer.hh │ │ │ │ │ │ ├── H264or5VideoFileSink.hh │ │ │ │ │ │ ├── H264or5VideoRTPSink.hh │ │ │ │ │ │ ├── H264or5VideoStreamDiscreteFramer.hh │ │ │ │ │ │ ├── H264or5VideoStreamFramer.hh │ │ │ │ │ │ ├── H265VideoFileServerMediaSubsession.hh │ │ │ │ │ │ ├── H265VideoFileSink.hh │ │ │ │ │ │ ├── H265VideoRTPSink.hh │ │ │ │ │ │ ├── H265VideoRTPSource.hh │ │ │ │ │ │ ├── H265VideoStreamDiscreteFramer.hh │ │ │ │ │ │ ├── H265VideoStreamFramer.hh │ │ │ │ │ │ ├── HLSSegmenter.hh │ │ │ │ │ │ ├── HMAC_SHA1.hh │ │ │ │ │ │ ├── HMAC_hash.hh │ │ │ │ │ │ ├── InputFile.hh │ │ │ │ │ │ ├── JPEG2000VideoRTPSink.hh │ │ │ │ │ │ ├── JPEG2000VideoRTPSource.hh │ │ │ │ │ │ ├── JPEGVideoRTPSink.hh │ │ │ │ │ │ ├── JPEGVideoRTPSource.hh │ │ │ │ │ │ ├── JPEGVideoSource.hh │ │ │ │ │ │ ├── Locale.hh │ │ │ │ │ │ ├── MIKEY.hh │ │ │ │ │ │ ├── MP3ADU.hh │ │ │ │ │ │ ├── MP3ADURTPSink.hh │ │ │ │ │ │ ├── MP3ADURTPSource.hh │ │ │ │ │ │ ├── MP3ADUTranscoder.hh │ │ │ │ │ │ ├── MP3ADUinterleaving.hh │ │ │ │ │ │ ├── MP3AudioFileServerMediaSubsession.hh │ │ │ │ │ │ ├── MP3FileSource.hh │ │ │ │ │ │ ├── MP3Transcoder.hh │ │ │ │ │ │ ├── MPEG1or2AudioRTPSink.hh │ │ │ │ │ │ ├── MPEG1or2AudioRTPSource.hh │ │ │ │ │ │ ├── MPEG1or2AudioStreamFramer.hh │ │ │ │ │ │ ├── MPEG1or2Demux.hh │ │ │ │ │ │ ├── MPEG1or2DemuxedElementaryStream.hh │ │ │ │ │ │ ├── MPEG1or2DemuxedServerMediaSubsession.hh │ │ │ │ │ │ ├── MPEG1or2FileServerDemux.hh │ │ │ │ │ │ ├── MPEG1or2VideoFileServerMediaSubsession.hh │ │ │ │ │ │ ├── MPEG1or2VideoRTPSink.hh │ │ │ │ │ │ ├── MPEG1or2VideoRTPSource.hh │ │ │ │ │ │ ├── MPEG1or2VideoStreamDiscreteFramer.hh │ │ │ │ │ │ ├── MPEG1or2VideoStreamFramer.hh │ │ │ │ │ │ ├── MPEG2IndexFromTransportStream.hh │ │ │ │ │ │ ├── MPEG2TransportFileServerMediaSubsession.hh │ │ │ │ │ │ ├── MPEG2TransportStreamAccumulator.hh │ │ │ │ │ │ ├── MPEG2TransportStreamDemux.hh │ │ │ │ │ │ ├── MPEG2TransportStreamFramer.hh │ │ │ │ │ │ ├── MPEG2TransportStreamFromESSource.hh │ │ │ │ │ │ ├── MPEG2TransportStreamFromPESSource.hh │ │ │ │ │ │ ├── MPEG2TransportStreamIndexFile.hh │ │ │ │ │ │ ├── MPEG2TransportStreamMultiplexor.hh │ │ │ │ │ │ ├── MPEG2TransportStreamTrickModeFilter.hh │ │ │ │ │ │ ├── MPEG2TransportUDPServerMediaSubsession.hh │ │ │ │ │ │ ├── MPEG4ESVideoRTPSink.hh │ │ │ │ │ │ ├── MPEG4ESVideoRTPSource.hh │ │ │ │ │ │ ├── MPEG4GenericRTPSink.hh │ │ │ │ │ │ ├── MPEG4GenericRTPSource.hh │ │ │ │ │ │ ├── MPEG4LATMAudioRTPSink.hh │ │ │ │ │ │ ├── MPEG4LATMAudioRTPSource.hh │ │ │ │ │ │ ├── MPEG4VideoFileServerMediaSubsession.hh │ │ │ │ │ │ ├── MPEG4VideoStreamDiscreteFramer.hh │ │ │ │ │ │ ├── MPEG4VideoStreamFramer.hh │ │ │ │ │ │ ├── MPEGVideoStreamFramer.hh │ │ │ │ │ │ ├── MatroskaFile.hh │ │ │ │ │ │ ├── MatroskaFileServerDemux.hh │ │ │ │ │ │ ├── Media.hh │ │ │ │ │ │ ├── MediaSession.hh │ │ │ │ │ │ ├── MediaSink.hh │ │ │ │ │ │ ├── MediaSource.hh │ │ │ │ │ │ ├── MediaTranscodingTable.hh │ │ │ │ │ │ ├── MultiFramedRTPSink.hh │ │ │ │ │ │ ├── MultiFramedRTPSource.hh │ │ │ │ │ │ ├── OggFile.hh │ │ │ │ │ │ ├── OggFileServerDemux.hh │ │ │ │ │ │ ├── OggFileSink.hh │ │ │ │ │ │ ├── OnDemandServerMediaSubsession.hh │ │ │ │ │ │ ├── OutputFile.hh │ │ │ │ │ │ ├── PassiveServerMediaSubsession.hh │ │ │ │ │ │ ├── ProxyServerMediaSession.hh │ │ │ │ │ │ ├── QCELPAudioRTPSource.hh │ │ │ │ │ │ ├── QuickTimeFileSink.hh │ │ │ │ │ │ ├── QuickTimeGenericRTPSource.hh │ │ │ │ │ │ ├── RTCP.hh │ │ │ │ │ │ ├── RTPInterface.hh │ │ │ │ │ │ ├── RTPSink.hh │ │ │ │ │ │ ├── RTPSource.hh │ │ │ │ │ │ ├── RTSPClient.hh │ │ │ │ │ │ ├── RTSPCommon.hh │ │ │ │ │ │ ├── RTSPRegisterSender.hh │ │ │ │ │ │ ├── RTSPServer.hh │ │ │ │ │ │ ├── RawVideoFrameParameters.hh │ │ │ │ │ │ ├── RawVideoRTPSink.hh │ │ │ │ │ │ ├── RawVideoRTPSource.hh │ │ │ │ │ │ ├── SIPClient.hh │ │ │ │ │ │ ├── SRTPCryptographicContext.hh │ │ │ │ │ │ ├── ServerMediaSession.hh │ │ │ │ │ │ ├── SimpleRTPSink.hh │ │ │ │ │ │ ├── SimpleRTPSource.hh │ │ │ │ │ │ ├── StreamReplicator.hh │ │ │ │ │ │ ├── T140TextRTPSink.hh │ │ │ │ │ │ ├── TLSState.hh │ │ │ │ │ │ ├── TextRTPSink.hh │ │ │ │ │ │ ├── TheoraVideoRTPSink.hh │ │ │ │ │ │ ├── TheoraVideoRTPSource.hh │ │ │ │ │ │ ├── VP8VideoRTPSink.hh │ │ │ │ │ │ ├── VP8VideoRTPSource.hh │ │ │ │ │ │ ├── VP9VideoRTPSink.hh │ │ │ │ │ │ ├── VP9VideoRTPSource.hh │ │ │ │ │ │ ├── VideoRTPSink.hh │ │ │ │ │ │ ├── VorbisAudioRTPSink.hh │ │ │ │ │ │ ├── VorbisAudioRTPSource.hh │ │ │ │ │ │ ├── WAVAudioFileServerMediaSubsession.hh │ │ │ │ │ │ ├── WAVAudioFileSource.hh │ │ │ │ │ │ ├── liveMedia.hh │ │ │ │ │ │ ├── liveMedia_version.hh │ │ │ │ │ │ ├── ourMD5.hh │ │ │ │ │ │ └── uLawAudioFilter.hh │ │ │ │ │ └── lib │ │ │ │ │ ├── libBasicUsageEnvironment.a │ │ │ │ │ ├── libUsageEnvironment.a │ │ │ │ │ ├── libgroupsock.a │ │ │ │ │ └── libliveMedia.a │ │ │ ├── live555.cpp │ │ │ └── live555.h │ │ ├── live555player_jni.cpp │ │ ├── logs.h │ │ ├── mediacodec │ │ │ ├── AACDecoder.cpp │ │ │ ├── AACDecoder.h │ │ │ ├── H264Decoder.cpp │ │ │ ├── H264Decoder.h │ │ │ ├── H265Decoder.cpp │ │ │ ├── H265Decoder.h │ │ │ └── geth264Frame.cpp │ │ ├── oboe-1.6.1 │ │ │ ├── AndroidManifest.xml │ │ │ └── prefab │ │ │ │ ├── modules │ │ │ │ └── oboe │ │ │ │ │ ├── include │ │ │ │ │ └── oboe │ │ │ │ │ │ ├── AudioStream.h │ │ │ │ │ │ ├── AudioStreamBase.h │ │ │ │ │ │ ├── AudioStreamBuilder.h │ │ │ │ │ │ ├── AudioStreamCallback.h │ │ │ │ │ │ ├── Definitions.h │ │ │ │ │ │ ├── LatencyTuner.h │ │ │ │ │ │ ├── Oboe.h │ │ │ │ │ │ ├── ResultWithValue.h │ │ │ │ │ │ ├── StabilizedCallback.h │ │ │ │ │ │ ├── Utilities.h │ │ │ │ │ │ └── Version.h │ │ │ │ │ ├── libs │ │ │ │ │ ├── android.arm64-v8a │ │ │ │ │ │ ├── abi.json │ │ │ │ │ │ └── liboboe.so │ │ │ │ │ ├── android.armeabi-v7a │ │ │ │ │ │ ├── abi.json │ │ │ │ │ │ └── liboboe.so │ │ │ │ │ ├── android.x86 │ │ │ │ │ │ ├── abi.json │ │ │ │ │ │ └── liboboe.so │ │ │ │ │ └── android.x86_64 │ │ │ │ │ │ ├── abi.json │ │ │ │ │ │ └── liboboe.so │ │ │ │ │ └── module.json │ │ │ │ └── prefab.json │ │ ├── queue.cpp │ │ ├── queue.h │ │ └── utils │ │ │ ├── aacUtils.cpp │ │ │ ├── aacUtils.h │ │ │ ├── timeUtils.cpp │ │ │ └── timeUtils.h │ ├── libs │ │ └── arm64-v8a │ │ │ └── liblive555player.so │ ├── obj │ │ └── local │ │ │ └── arm64-v8a │ │ │ ├── libBasicUsageEnvironment.so │ │ │ ├── libUsageEnvironment.so │ │ │ ├── libc++.so │ │ │ ├── libc++_shared.so │ │ │ ├── libgroupsock.so │ │ │ ├── liblive555player.so │ │ │ ├── libliveMedia.so │ │ │ └── objs │ │ │ └── live555player │ │ │ ├── live555 │ │ │ ├── live555.o │ │ │ └── live555.o.d │ │ │ ├── live555player_jni.o │ │ │ ├── live555player_jni.o.d │ │ │ ├── mediacodec │ │ │ ├── Decoder.o │ │ │ └── Decoder.o.d │ │ │ ├── queue.o │ │ │ └── queue.o.d │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── example │ └── live555 │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /README.md: -------------------------------------------------------------------------------- 1 | # openScreen 2 | 投屏 3 | 个人业余时间写的一些相关demo。 4 | 当前正在逐渐增加子模块,前期已单个独立的demoapp 方式,待完成后进行串联整合 5 | 20210803:子目录下clientAndroid/live555 6 | 使用live555+mediacode(ndk) 拉流,解码渲染 rtp-udp h264 7 | 20210811:新增 clientAndroid/aacplayer 8 | 使用mediacode解码aac文件,c反过来调用java的AudioTrack 播放(或者可以使用opensl,android AudioTrack在ndk层未开放 . 可以使用AAudio,Android O 8.0 引入的native层接口, 或者直接使用oboe开源库) 9 | ![Screenshot_2022-05-22-15-12-23-291_com example live555](https://user-images.githubusercontent.com/41246028/169683778-25e1c009-e35e-4c75-9fd5-ab8fc8b971a3.png) 10 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdkVersion 30 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | applicationId "com.example.aacplayer" 11 | minSdkVersion 21 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | 18 | ndk{ 19 | abiFilters "arm64-v8a" //,"armeabi-v7a" 20 | } 21 | } 22 | 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | externalNativeBuild{ 34 | ndkBuild{ 35 | path file("src/main/jni/Android.mk") 36 | } 37 | } 38 | } 39 | 40 | dependencies { 41 | 42 | implementation 'androidx.appcompat:appcompat:1.1.0' 43 | implementation 'com.google.android.material:material:1.1.0' 44 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 45 | testImplementation 'junit:junit:4.+' 46 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 47 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 48 | } -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/androidTest/java/com/example/aacplayer/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.aacplayer; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.example.aacplayer", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/assets/test.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Canok7/openScreen/e7946bf1b4cf43dcec3fa9149c2cf82966b04e34/clientAndroid/AACPlayer/app/src/main/assets/test.aac -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/AACFileparser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/10/21. 3 | // 4 | 5 | #ifndef AACPLAYER_AACFILEPARSER_H 6 | #define AACPLAYER_AACFILEPARSER_H 7 | #include 8 | #include 9 | 10 | class AACFileparser { 11 | public: 12 | AACFileparser(const char*file, bool loop=true); 13 | ~AACFileparser(); 14 | int getOneFrameWithoutADTS(unsigned char *dest,int buflen); 15 | int getOneFrameFull(unsigned char *dest,int buflen); 16 | int probeInfo(int *channel, int *samplingFrequency,int *sampleFreInd,int *iprofile); 17 | private: 18 | FILE *fp_in; 19 | int sample; 20 | int channel; 21 | bool bLoop; 22 | }; 23 | 24 | 25 | #endif //AACPLAYER_AACFILEPARSER_H 26 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/AACMediacodecDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/13/21. 3 | // 4 | 5 | #ifndef AACPLAYER_AACMEDIACODECDECODER_H 6 | #define AACPLAYER_AACMEDIACODECDECODER_H 7 | 8 | #include "IAudioRender.h" 9 | #include "media/NdkMediaCodec.h" 10 | #include "media/NdkMediaFormat.h" 11 | class AACMediacodecDecoder { 12 | public : 13 | AACMediacodecDecoder(); 14 | ~AACMediacodecDecoder(); 15 | int init(int chanle,int sampleFrequency,int sampleFreIndex,int profile); 16 | int start(IAudioRender *render); 17 | int stop(); 18 | int dodecode(unsigned char*data,int len); 19 | void run(); 20 | private: 21 | bool bRun; 22 | AMediaCodec *pMediaCodec; 23 | IAudioRender *pRender; 24 | pthread_t pidRender; 25 | }; 26 | 27 | 28 | #endif //AACPLAYER_AACMEDIACODECDECODER_H 29 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | LOCAL_MODULE := aacDecoder 4 | LOCAL_SRC_FILES := AudioTrackRender_jni.cpp 5 | LOCAL_SRC_FILES += AACFileparser.cpp 6 | LOCAL_SRC_FILES += Utils.cpp 7 | LOCAL_SRC_FILES += JavaAudioTrackRender.cpp 8 | LOCAL_SRC_FILES += AACMediacodecDecoder.cpp 9 | LOCAL_LDLIBS := -lmediandk -llog 10 | LOCAL_CFLAGS += -Wall -Werror -Wno-unused-variable -Wno-reorder 11 | include $(BUILD_SHARED_LIBRARY) -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/IAudioRender.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/13/21. 3 | // 4 | 5 | #ifndef AACPLAYER_IAUDIORENDER_H 6 | #define AACPLAYER_IAUDIORENDER_H 7 | 8 | 9 | class IAudioRender { 10 | public: 11 | IAudioRender(){} 12 | ~IAudioRender(){} 13 | virtual int init(int sampleRateInHz, int channelConfig,int sampleDepth)=0; 14 | virtual void play(unsigned char *buf,int size)=0; 15 | }; 16 | 17 | 18 | #endif //AACPLAYER_IAUDIORENDER_H 19 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/JavaAudioTrackRender.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/13/21. 3 | // 4 | 5 | #ifndef AACPLAYER_JAVAAUDIOTRACKRENDER_H 6 | #define AACPLAYER_JAVAAUDIOTRACKRENDER_H 7 | 8 | #include "IAudioRender.h" 9 | #include 10 | class JavaAudioTrackRender :public IAudioRender{ 11 | public: 12 | JavaAudioTrackRender(JavaVM *JVM, jobject obj); 13 | ~JavaAudioTrackRender(); 14 | virtual int init(int sampleRateInHz, int channelConfig,int sampleDepth); 15 | virtual void play(unsigned char*buf,int size); 16 | private: 17 | int init_callJava(); 18 | private: 19 | JavaVM *mjvm; //与进程对应的虚拟机 20 | jclass mjcla;//该对象的类,用来获取方法 21 | jobject mjobj; 22 | JNIEnv *mEnv;//与线程绑定的env 23 | jmethodID mj_playByteArray; 24 | jmethodID mj_playByteBuffer; 25 | jmethodID mj_init; 26 | int mSampleRateInHz; 27 | int mChannelConfig; 28 | int mSampleDepth; 29 | }; 30 | 31 | 32 | #endif //AACPLAYER_JAVAAUDIOTRACKRENDER_H 33 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/Logs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/10/21. 3 | // 4 | 5 | #ifndef AACPLAYER_LOGS_H 6 | #define AACPLAYER_LOGS_H 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #include 11 | #define LOG_TAG "JNILOG" // 这个是自定义的LOG的标识 12 | #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG, __VA_ARGS__) 13 | #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG, __VA_ARGS__) 14 | #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG, __VA_ARGS__) 15 | #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG, __VA_ARGS__) 16 | #define ALOGF(...) __android_log_print(ANDROID_LOG_FATAL,LOG_TAG, __VA_ARGS__) 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif //AACPLAYER_LOGS_H 22 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/Utils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/11/21. 3 | // 4 | 5 | #include "Utils.h" 6 | 7 | //想用Mediacodec ,得遵循mediacodec的规则,什么样的规则?没有说明,只能看源码。 8 | //以下函数,可以创建 aac 的csd-0 参数,从android源码拷贝来的。 9 | //frome framworks/av/media/libstagefright/MeteDataUntils.cpp , android mediacodec 专门为部分编解码器设置的 Codec specific data,特殊信息,什么样的格式???看android 源码 10 | bool Utils::MakeAACCodecSpecificData(AMediaFormat *meta, unsigned profile, unsigned sampling_freq_index, 11 | unsigned channel_configuration) { 12 | 13 | if(sampling_freq_index > 11u) { 14 | return false; 15 | } 16 | 17 | uint8_t csd[2]; 18 | csd[0] = ((profile + 1) << 3) | (sampling_freq_index >> 1); 19 | csd[1] = ((sampling_freq_index << 7) & 0x80) | (channel_configuration << 3); 20 | 21 | static const int32_t kSamplingFreq[] = { 22 | 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 23 | 16000, 12000, 11025, 8000 24 | }; 25 | int32_t sampleRate = kSamplingFreq[sampling_freq_index]; 26 | 27 | // AMediaFormat_setBuffer(meta, AMEDIAFORMAT_KEY_CSD_0, csd, sizeof(csd));//api 28 28 | AMediaFormat_setBuffer(meta, "csd-0", csd, sizeof(csd)); 29 | // AMediaFormat_setString(meta, AMEDIAFORMAT_KEY_MIME, MEDIA_MIMETYPE_AUDIO_AAC); 30 | AMediaFormat_setInt32(meta, AMEDIAFORMAT_KEY_SAMPLE_RATE, sampleRate); 31 | AMediaFormat_setInt32(meta, AMEDIAFORMAT_KEY_CHANNEL_COUNT, channel_configuration); 32 | 33 | return true; 34 | } -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/jni/Utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xiancan.wang on 8/11/21. 3 | // 4 | 5 | #ifndef AACPLAYER_UTILS_H 6 | #define AACPLAYER_UTILS_H 7 | #include "media/NdkMediaCodec.h" 8 | #include "media/NdkMediaFormat.h" 9 | 10 | class Utils { 11 | 12 | public: 13 | static bool MakeAACCodecSpecificData(AMediaFormat *meta, unsigned profile, unsigned sampling_freq_index, 14 | unsigned channel_configuration); 15 | }; 16 | 17 | 18 | #endif //AACPLAYER_UTILS_H 19 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /clientAndroid/AACPlayer/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 |