diff --git a/CMakeLists.txt b/CMakeLists.txt index f91af2e..6d10f79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.7) -set(PROJECT_NAME recive) -project(${PROJECT_NAME}) +set(PROJECT_NAME rtspReceive) +#project(${PROJECT_NAME}) +project(${PROJECT_NAME}) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -9,16 +10,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) add_definitions(-DLIVEMEDIA_API=) add_definitions(-DNO_OPENSSL=1) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/rtc) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/nlohmann) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/nlohmann/detail) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/nlohmann/thirdparty) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg/libavcodec) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg/libavformat) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg/libavutil) +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/ffmpeg) +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/ffmpeg/libavcodec) +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/ffmpeg/libavformat) +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/ffmpeg/libavutil) set(LIBS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs) @@ -30,25 +32,27 @@ link_libraries(datachannel) link_libraries(json) # for ffmpeg -link_directories(${LIBS_PATH}/ffmpeg) -link_libraries(avcodec) -link_libraries(avdevice) -link_libraries(avutil) +link_libraries(ffmpeg) +# link_libraries(avcodec) +# link_libraries(avformat) +# link_libraries(avutil) + aux_source_directory(./src DIR_SRCS) add_executable(${PROJECT_NAME} ${DIR_SRCS}) # shared -# find_package(Threads REQUIRED) -# target_link_libraries(${PROJECT_NAME} Threads::Threads) -# target_link_libraries(${PROJECT_NAME} ws2_32) +find_package(Threads REQUIRED) +target_link_libraries(${PROJECT_NAME} Threads::Threads) +target_link_libraries(${PROJECT_NAME} ws2_32) # Copy dll to run dir. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/datachannel.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avcodec-60.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avformat-60.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avutil-58.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/postproc-57.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/swresample-4.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avcodec-60.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avformat-60.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avutil-58.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/postproc-57.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/swresample-4.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + diff --git a/ffmpeg/CMakeLists.txt b/ffmpeg/CMakeLists.txt new file mode 100644 index 0000000..d0e8e43 --- /dev/null +++ b/ffmpeg/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.4.1) +project(ffmpeg) + +# set(FFMPEG_PATH ${PROJECT_SOURCE_DIR}/${ANDROID_ABI}) +set(FFMPEG_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + + +add_library(ffmpeg INTERFACE) +link_directories(${FFMPEG_PATH}/libs) +target_include_directories(ffmpeg INTERFACE ${FFMPEG_PATH}/ffmpeg) +target_link_libraries(ffmpeg INTERFACE + ${FFMPEG_PATH}/libs/avformat.lib + ${FFMPEG_PATH}/libs/avcodec.lib + ${FFMPEG_PATH}/libs/avutil.lib + ${FFMPEG_PATH}/libs/swresample.lib + ${FFMPEG_PATH}/libs/swscale.lib +) +# target_link_libraries(ffmpeg INTERFACE +# "${FFMPEG_PATH}/libavformat.a" +# "${FFMPEG_PATH}/libavcodec.a" +# "${FFMPEG_PATH}/libavutil.a" +# "${FFMPEG_PATH}/libswresample.a" +# "${FFMPEG_PATH}/libswscale.a" +# ) diff --git a/includes/ffmpeg/libavcodec/ac3_parser.h b/ffmpeg/ffmpeg/libavcodec/ac3_parser.h similarity index 100% rename from includes/ffmpeg/libavcodec/ac3_parser.h rename to ffmpeg/ffmpeg/libavcodec/ac3_parser.h diff --git a/includes/ffmpeg/libavcodec/adts_parser.h b/ffmpeg/ffmpeg/libavcodec/adts_parser.h similarity index 100% rename from includes/ffmpeg/libavcodec/adts_parser.h rename to ffmpeg/ffmpeg/libavcodec/adts_parser.h diff --git a/includes/ffmpeg/libavcodec/avcodec.h b/ffmpeg/ffmpeg/libavcodec/avcodec.h similarity index 100% rename from includes/ffmpeg/libavcodec/avcodec.h rename to ffmpeg/ffmpeg/libavcodec/avcodec.h diff --git a/includes/ffmpeg/libavcodec/avdct.h b/ffmpeg/ffmpeg/libavcodec/avdct.h similarity index 100% rename from includes/ffmpeg/libavcodec/avdct.h rename to ffmpeg/ffmpeg/libavcodec/avdct.h diff --git a/includes/ffmpeg/libavcodec/avfft.h b/ffmpeg/ffmpeg/libavcodec/avfft.h similarity index 100% rename from includes/ffmpeg/libavcodec/avfft.h rename to ffmpeg/ffmpeg/libavcodec/avfft.h diff --git a/includes/ffmpeg/libavcodec/bsf.h b/ffmpeg/ffmpeg/libavcodec/bsf.h similarity index 100% rename from includes/ffmpeg/libavcodec/bsf.h rename to ffmpeg/ffmpeg/libavcodec/bsf.h diff --git a/includes/ffmpeg/libavcodec/codec.h b/ffmpeg/ffmpeg/libavcodec/codec.h similarity index 100% rename from includes/ffmpeg/libavcodec/codec.h rename to ffmpeg/ffmpeg/libavcodec/codec.h diff --git a/includes/ffmpeg/libavcodec/codec_desc.h b/ffmpeg/ffmpeg/libavcodec/codec_desc.h similarity index 100% rename from includes/ffmpeg/libavcodec/codec_desc.h rename to ffmpeg/ffmpeg/libavcodec/codec_desc.h diff --git a/includes/ffmpeg/libavcodec/codec_id.h b/ffmpeg/ffmpeg/libavcodec/codec_id.h similarity index 100% rename from includes/ffmpeg/libavcodec/codec_id.h rename to ffmpeg/ffmpeg/libavcodec/codec_id.h diff --git a/includes/ffmpeg/libavcodec/codec_par.h b/ffmpeg/ffmpeg/libavcodec/codec_par.h similarity index 100% rename from includes/ffmpeg/libavcodec/codec_par.h rename to ffmpeg/ffmpeg/libavcodec/codec_par.h diff --git a/includes/ffmpeg/libavcodec/d3d11va.h b/ffmpeg/ffmpeg/libavcodec/d3d11va.h similarity index 100% rename from includes/ffmpeg/libavcodec/d3d11va.h rename to ffmpeg/ffmpeg/libavcodec/d3d11va.h diff --git a/includes/ffmpeg/libavcodec/defs.h b/ffmpeg/ffmpeg/libavcodec/defs.h similarity index 100% rename from includes/ffmpeg/libavcodec/defs.h rename to ffmpeg/ffmpeg/libavcodec/defs.h diff --git a/includes/ffmpeg/libavcodec/dirac.h b/ffmpeg/ffmpeg/libavcodec/dirac.h similarity index 100% rename from includes/ffmpeg/libavcodec/dirac.h rename to ffmpeg/ffmpeg/libavcodec/dirac.h diff --git a/includes/ffmpeg/libavcodec/dv_profile.h b/ffmpeg/ffmpeg/libavcodec/dv_profile.h similarity index 100% rename from includes/ffmpeg/libavcodec/dv_profile.h rename to ffmpeg/ffmpeg/libavcodec/dv_profile.h diff --git a/includes/ffmpeg/libavcodec/dxva2.h b/ffmpeg/ffmpeg/libavcodec/dxva2.h similarity index 100% rename from includes/ffmpeg/libavcodec/dxva2.h rename to ffmpeg/ffmpeg/libavcodec/dxva2.h diff --git a/includes/ffmpeg/libavcodec/jni.h b/ffmpeg/ffmpeg/libavcodec/jni.h similarity index 100% rename from includes/ffmpeg/libavcodec/jni.h rename to ffmpeg/ffmpeg/libavcodec/jni.h diff --git a/includes/ffmpeg/libavcodec/mediacodec.h b/ffmpeg/ffmpeg/libavcodec/mediacodec.h similarity index 100% rename from includes/ffmpeg/libavcodec/mediacodec.h rename to ffmpeg/ffmpeg/libavcodec/mediacodec.h diff --git a/includes/ffmpeg/libavcodec/packet.h b/ffmpeg/ffmpeg/libavcodec/packet.h similarity index 100% rename from includes/ffmpeg/libavcodec/packet.h rename to ffmpeg/ffmpeg/libavcodec/packet.h diff --git a/includes/ffmpeg/libavcodec/qsv.h b/ffmpeg/ffmpeg/libavcodec/qsv.h similarity index 100% rename from includes/ffmpeg/libavcodec/qsv.h rename to ffmpeg/ffmpeg/libavcodec/qsv.h diff --git a/includes/ffmpeg/libavcodec/vdpau.h b/ffmpeg/ffmpeg/libavcodec/vdpau.h similarity index 100% rename from includes/ffmpeg/libavcodec/vdpau.h rename to ffmpeg/ffmpeg/libavcodec/vdpau.h diff --git a/includes/ffmpeg/libavcodec/version.h b/ffmpeg/ffmpeg/libavcodec/version.h similarity index 100% rename from includes/ffmpeg/libavcodec/version.h rename to ffmpeg/ffmpeg/libavcodec/version.h diff --git a/includes/ffmpeg/libavcodec/version_major.h b/ffmpeg/ffmpeg/libavcodec/version_major.h similarity index 100% rename from includes/ffmpeg/libavcodec/version_major.h rename to ffmpeg/ffmpeg/libavcodec/version_major.h diff --git a/includes/ffmpeg/libavcodec/videotoolbox.h b/ffmpeg/ffmpeg/libavcodec/videotoolbox.h similarity index 100% rename from includes/ffmpeg/libavcodec/videotoolbox.h rename to ffmpeg/ffmpeg/libavcodec/videotoolbox.h diff --git a/includes/ffmpeg/libavcodec/vorbis_parser.h b/ffmpeg/ffmpeg/libavcodec/vorbis_parser.h similarity index 100% rename from includes/ffmpeg/libavcodec/vorbis_parser.h rename to ffmpeg/ffmpeg/libavcodec/vorbis_parser.h diff --git a/includes/ffmpeg/libavcodec/xvmc.h b/ffmpeg/ffmpeg/libavcodec/xvmc.h similarity index 100% rename from includes/ffmpeg/libavcodec/xvmc.h rename to ffmpeg/ffmpeg/libavcodec/xvmc.h diff --git a/includes/ffmpeg/libavformat/avformat.h b/ffmpeg/ffmpeg/libavformat/avformat.h similarity index 100% rename from includes/ffmpeg/libavformat/avformat.h rename to ffmpeg/ffmpeg/libavformat/avformat.h diff --git a/includes/ffmpeg/libavformat/avio.h b/ffmpeg/ffmpeg/libavformat/avio.h similarity index 100% rename from includes/ffmpeg/libavformat/avio.h rename to ffmpeg/ffmpeg/libavformat/avio.h diff --git a/includes/ffmpeg/libavformat/version.h b/ffmpeg/ffmpeg/libavformat/version.h similarity index 100% rename from includes/ffmpeg/libavformat/version.h rename to ffmpeg/ffmpeg/libavformat/version.h diff --git a/includes/ffmpeg/libavformat/version_major.h b/ffmpeg/ffmpeg/libavformat/version_major.h similarity index 100% rename from includes/ffmpeg/libavformat/version_major.h rename to ffmpeg/ffmpeg/libavformat/version_major.h diff --git a/includes/ffmpeg/libavutil/adler32.h b/ffmpeg/ffmpeg/libavutil/adler32.h similarity index 100% rename from includes/ffmpeg/libavutil/adler32.h rename to ffmpeg/ffmpeg/libavutil/adler32.h diff --git a/includes/ffmpeg/libavutil/aes.h b/ffmpeg/ffmpeg/libavutil/aes.h similarity index 100% rename from includes/ffmpeg/libavutil/aes.h rename to ffmpeg/ffmpeg/libavutil/aes.h diff --git a/includes/ffmpeg/libavutil/aes_ctr.h b/ffmpeg/ffmpeg/libavutil/aes_ctr.h similarity index 100% rename from includes/ffmpeg/libavutil/aes_ctr.h rename to ffmpeg/ffmpeg/libavutil/aes_ctr.h diff --git a/includes/ffmpeg/libavutil/ambient_viewing_environment.h b/ffmpeg/ffmpeg/libavutil/ambient_viewing_environment.h similarity index 100% rename from includes/ffmpeg/libavutil/ambient_viewing_environment.h rename to ffmpeg/ffmpeg/libavutil/ambient_viewing_environment.h diff --git a/includes/ffmpeg/libavutil/attributes.h b/ffmpeg/ffmpeg/libavutil/attributes.h similarity index 100% rename from includes/ffmpeg/libavutil/attributes.h rename to ffmpeg/ffmpeg/libavutil/attributes.h diff --git a/includes/ffmpeg/libavutil/audio_fifo.h b/ffmpeg/ffmpeg/libavutil/audio_fifo.h similarity index 100% rename from includes/ffmpeg/libavutil/audio_fifo.h rename to ffmpeg/ffmpeg/libavutil/audio_fifo.h diff --git a/includes/ffmpeg/libavutil/avassert.h b/ffmpeg/ffmpeg/libavutil/avassert.h similarity index 100% rename from includes/ffmpeg/libavutil/avassert.h rename to ffmpeg/ffmpeg/libavutil/avassert.h diff --git a/includes/ffmpeg/libavutil/avconfig.h b/ffmpeg/ffmpeg/libavutil/avconfig.h similarity index 100% rename from includes/ffmpeg/libavutil/avconfig.h rename to ffmpeg/ffmpeg/libavutil/avconfig.h diff --git a/includes/ffmpeg/libavutil/avstring.h b/ffmpeg/ffmpeg/libavutil/avstring.h similarity index 100% rename from includes/ffmpeg/libavutil/avstring.h rename to ffmpeg/ffmpeg/libavutil/avstring.h diff --git a/includes/ffmpeg/libavutil/avutil.h b/ffmpeg/ffmpeg/libavutil/avutil.h similarity index 100% rename from includes/ffmpeg/libavutil/avutil.h rename to ffmpeg/ffmpeg/libavutil/avutil.h diff --git a/includes/ffmpeg/libavutil/base64.h b/ffmpeg/ffmpeg/libavutil/base64.h similarity index 100% rename from includes/ffmpeg/libavutil/base64.h rename to ffmpeg/ffmpeg/libavutil/base64.h diff --git a/includes/ffmpeg/libavutil/blowfish.h b/ffmpeg/ffmpeg/libavutil/blowfish.h similarity index 100% rename from includes/ffmpeg/libavutil/blowfish.h rename to ffmpeg/ffmpeg/libavutil/blowfish.h diff --git a/includes/ffmpeg/libavutil/bprint.h b/ffmpeg/ffmpeg/libavutil/bprint.h similarity index 100% rename from includes/ffmpeg/libavutil/bprint.h rename to ffmpeg/ffmpeg/libavutil/bprint.h diff --git a/includes/ffmpeg/libavutil/bswap.h b/ffmpeg/ffmpeg/libavutil/bswap.h similarity index 100% rename from includes/ffmpeg/libavutil/bswap.h rename to ffmpeg/ffmpeg/libavutil/bswap.h diff --git a/includes/ffmpeg/libavutil/buffer.h b/ffmpeg/ffmpeg/libavutil/buffer.h similarity index 100% rename from includes/ffmpeg/libavutil/buffer.h rename to ffmpeg/ffmpeg/libavutil/buffer.h diff --git a/includes/ffmpeg/libavutil/camellia.h b/ffmpeg/ffmpeg/libavutil/camellia.h similarity index 100% rename from includes/ffmpeg/libavutil/camellia.h rename to ffmpeg/ffmpeg/libavutil/camellia.h diff --git a/includes/ffmpeg/libavutil/cast5.h b/ffmpeg/ffmpeg/libavutil/cast5.h similarity index 100% rename from includes/ffmpeg/libavutil/cast5.h rename to ffmpeg/ffmpeg/libavutil/cast5.h diff --git a/includes/ffmpeg/libavutil/channel_layout.h b/ffmpeg/ffmpeg/libavutil/channel_layout.h similarity index 100% rename from includes/ffmpeg/libavutil/channel_layout.h rename to ffmpeg/ffmpeg/libavutil/channel_layout.h diff --git a/includes/ffmpeg/libavutil/common.h b/ffmpeg/ffmpeg/libavutil/common.h similarity index 100% rename from includes/ffmpeg/libavutil/common.h rename to ffmpeg/ffmpeg/libavutil/common.h diff --git a/includes/ffmpeg/libavutil/cpu.h b/ffmpeg/ffmpeg/libavutil/cpu.h similarity index 100% rename from includes/ffmpeg/libavutil/cpu.h rename to ffmpeg/ffmpeg/libavutil/cpu.h diff --git a/includes/ffmpeg/libavutil/crc.h b/ffmpeg/ffmpeg/libavutil/crc.h similarity index 100% rename from includes/ffmpeg/libavutil/crc.h rename to ffmpeg/ffmpeg/libavutil/crc.h diff --git a/includes/ffmpeg/libavutil/csp.h b/ffmpeg/ffmpeg/libavutil/csp.h similarity index 100% rename from includes/ffmpeg/libavutil/csp.h rename to ffmpeg/ffmpeg/libavutil/csp.h diff --git a/includes/ffmpeg/libavutil/des.h b/ffmpeg/ffmpeg/libavutil/des.h similarity index 100% rename from includes/ffmpeg/libavutil/des.h rename to ffmpeg/ffmpeg/libavutil/des.h diff --git a/includes/ffmpeg/libavutil/detection_bbox.h b/ffmpeg/ffmpeg/libavutil/detection_bbox.h similarity index 100% rename from includes/ffmpeg/libavutil/detection_bbox.h rename to ffmpeg/ffmpeg/libavutil/detection_bbox.h diff --git a/includes/ffmpeg/libavutil/dict.h b/ffmpeg/ffmpeg/libavutil/dict.h similarity index 100% rename from includes/ffmpeg/libavutil/dict.h rename to ffmpeg/ffmpeg/libavutil/dict.h diff --git a/includes/ffmpeg/libavutil/display.h b/ffmpeg/ffmpeg/libavutil/display.h similarity index 100% rename from includes/ffmpeg/libavutil/display.h rename to ffmpeg/ffmpeg/libavutil/display.h diff --git a/includes/ffmpeg/libavutil/dovi_meta.h b/ffmpeg/ffmpeg/libavutil/dovi_meta.h similarity index 100% rename from includes/ffmpeg/libavutil/dovi_meta.h rename to ffmpeg/ffmpeg/libavutil/dovi_meta.h diff --git a/includes/ffmpeg/libavutil/downmix_info.h b/ffmpeg/ffmpeg/libavutil/downmix_info.h similarity index 100% rename from includes/ffmpeg/libavutil/downmix_info.h rename to ffmpeg/ffmpeg/libavutil/downmix_info.h diff --git a/includes/ffmpeg/libavutil/encryption_info.h b/ffmpeg/ffmpeg/libavutil/encryption_info.h similarity index 100% rename from includes/ffmpeg/libavutil/encryption_info.h rename to ffmpeg/ffmpeg/libavutil/encryption_info.h diff --git a/includes/ffmpeg/libavutil/error.h b/ffmpeg/ffmpeg/libavutil/error.h similarity index 100% rename from includes/ffmpeg/libavutil/error.h rename to ffmpeg/ffmpeg/libavutil/error.h diff --git a/includes/ffmpeg/libavutil/eval.h b/ffmpeg/ffmpeg/libavutil/eval.h similarity index 100% rename from includes/ffmpeg/libavutil/eval.h rename to ffmpeg/ffmpeg/libavutil/eval.h diff --git a/includes/ffmpeg/libavutil/executor.h b/ffmpeg/ffmpeg/libavutil/executor.h similarity index 100% rename from includes/ffmpeg/libavutil/executor.h rename to ffmpeg/ffmpeg/libavutil/executor.h diff --git a/includes/ffmpeg/libavutil/ffversion.h b/ffmpeg/ffmpeg/libavutil/ffversion.h similarity index 100% rename from includes/ffmpeg/libavutil/ffversion.h rename to ffmpeg/ffmpeg/libavutil/ffversion.h diff --git a/includes/ffmpeg/libavutil/fifo.h b/ffmpeg/ffmpeg/libavutil/fifo.h similarity index 100% rename from includes/ffmpeg/libavutil/fifo.h rename to ffmpeg/ffmpeg/libavutil/fifo.h diff --git a/includes/ffmpeg/libavutil/file.h b/ffmpeg/ffmpeg/libavutil/file.h similarity index 100% rename from includes/ffmpeg/libavutil/file.h rename to ffmpeg/ffmpeg/libavutil/file.h diff --git a/includes/ffmpeg/libavutil/film_grain_params.h b/ffmpeg/ffmpeg/libavutil/film_grain_params.h similarity index 100% rename from includes/ffmpeg/libavutil/film_grain_params.h rename to ffmpeg/ffmpeg/libavutil/film_grain_params.h diff --git a/includes/ffmpeg/libavutil/frame.h b/ffmpeg/ffmpeg/libavutil/frame.h similarity index 100% rename from includes/ffmpeg/libavutil/frame.h rename to ffmpeg/ffmpeg/libavutil/frame.h diff --git a/includes/ffmpeg/libavutil/hash.h b/ffmpeg/ffmpeg/libavutil/hash.h similarity index 100% rename from includes/ffmpeg/libavutil/hash.h rename to ffmpeg/ffmpeg/libavutil/hash.h diff --git a/includes/ffmpeg/libavutil/hdr_dynamic_metadata.h b/ffmpeg/ffmpeg/libavutil/hdr_dynamic_metadata.h similarity index 100% rename from includes/ffmpeg/libavutil/hdr_dynamic_metadata.h rename to ffmpeg/ffmpeg/libavutil/hdr_dynamic_metadata.h diff --git a/includes/ffmpeg/libavutil/hdr_dynamic_vivid_metadata.h b/ffmpeg/ffmpeg/libavutil/hdr_dynamic_vivid_metadata.h similarity index 100% rename from includes/ffmpeg/libavutil/hdr_dynamic_vivid_metadata.h rename to ffmpeg/ffmpeg/libavutil/hdr_dynamic_vivid_metadata.h diff --git a/includes/ffmpeg/libavutil/hmac.h b/ffmpeg/ffmpeg/libavutil/hmac.h similarity index 100% rename from includes/ffmpeg/libavutil/hmac.h rename to ffmpeg/ffmpeg/libavutil/hmac.h diff --git a/includes/ffmpeg/libavutil/hwcontext.h b/ffmpeg/ffmpeg/libavutil/hwcontext.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext.h rename to ffmpeg/ffmpeg/libavutil/hwcontext.h diff --git a/includes/ffmpeg/libavutil/hwcontext_cuda.h b/ffmpeg/ffmpeg/libavutil/hwcontext_cuda.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_cuda.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_cuda.h diff --git a/includes/ffmpeg/libavutil/hwcontext_d3d11va.h b/ffmpeg/ffmpeg/libavutil/hwcontext_d3d11va.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_d3d11va.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_d3d11va.h diff --git a/includes/ffmpeg/libavutil/hwcontext_drm.h b/ffmpeg/ffmpeg/libavutil/hwcontext_drm.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_drm.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_drm.h diff --git a/includes/ffmpeg/libavutil/hwcontext_dxva2.h b/ffmpeg/ffmpeg/libavutil/hwcontext_dxva2.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_dxva2.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_dxva2.h diff --git a/includes/ffmpeg/libavutil/hwcontext_mediacodec.h b/ffmpeg/ffmpeg/libavutil/hwcontext_mediacodec.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_mediacodec.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_mediacodec.h diff --git a/includes/ffmpeg/libavutil/hwcontext_opencl.h b/ffmpeg/ffmpeg/libavutil/hwcontext_opencl.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_opencl.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_opencl.h diff --git a/includes/ffmpeg/libavutil/hwcontext_qsv.h b/ffmpeg/ffmpeg/libavutil/hwcontext_qsv.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_qsv.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_qsv.h diff --git a/includes/ffmpeg/libavutil/hwcontext_vaapi.h b/ffmpeg/ffmpeg/libavutil/hwcontext_vaapi.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_vaapi.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_vaapi.h diff --git a/includes/ffmpeg/libavutil/hwcontext_vdpau.h b/ffmpeg/ffmpeg/libavutil/hwcontext_vdpau.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_vdpau.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_vdpau.h diff --git a/includes/ffmpeg/libavutil/hwcontext_videotoolbox.h b/ffmpeg/ffmpeg/libavutil/hwcontext_videotoolbox.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_videotoolbox.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_videotoolbox.h diff --git a/includes/ffmpeg/libavutil/hwcontext_vulkan.h b/ffmpeg/ffmpeg/libavutil/hwcontext_vulkan.h similarity index 100% rename from includes/ffmpeg/libavutil/hwcontext_vulkan.h rename to ffmpeg/ffmpeg/libavutil/hwcontext_vulkan.h diff --git a/includes/ffmpeg/libavutil/imgutils.h b/ffmpeg/ffmpeg/libavutil/imgutils.h similarity index 100% rename from includes/ffmpeg/libavutil/imgutils.h rename to ffmpeg/ffmpeg/libavutil/imgutils.h diff --git a/includes/ffmpeg/libavutil/intfloat.h b/ffmpeg/ffmpeg/libavutil/intfloat.h similarity index 100% rename from includes/ffmpeg/libavutil/intfloat.h rename to ffmpeg/ffmpeg/libavutil/intfloat.h diff --git a/includes/ffmpeg/libavutil/intreadwrite.h b/ffmpeg/ffmpeg/libavutil/intreadwrite.h similarity index 100% rename from includes/ffmpeg/libavutil/intreadwrite.h rename to ffmpeg/ffmpeg/libavutil/intreadwrite.h diff --git a/includes/ffmpeg/libavutil/lfg.h b/ffmpeg/ffmpeg/libavutil/lfg.h similarity index 100% rename from includes/ffmpeg/libavutil/lfg.h rename to ffmpeg/ffmpeg/libavutil/lfg.h diff --git a/includes/ffmpeg/libavutil/log.h b/ffmpeg/ffmpeg/libavutil/log.h similarity index 100% rename from includes/ffmpeg/libavutil/log.h rename to ffmpeg/ffmpeg/libavutil/log.h diff --git a/includes/ffmpeg/libavutil/lzo.h b/ffmpeg/ffmpeg/libavutil/lzo.h similarity index 100% rename from includes/ffmpeg/libavutil/lzo.h rename to ffmpeg/ffmpeg/libavutil/lzo.h diff --git a/includes/ffmpeg/libavutil/macros.h b/ffmpeg/ffmpeg/libavutil/macros.h similarity index 100% rename from includes/ffmpeg/libavutil/macros.h rename to ffmpeg/ffmpeg/libavutil/macros.h diff --git a/includes/ffmpeg/libavutil/mastering_display_metadata.h b/ffmpeg/ffmpeg/libavutil/mastering_display_metadata.h similarity index 100% rename from includes/ffmpeg/libavutil/mastering_display_metadata.h rename to ffmpeg/ffmpeg/libavutil/mastering_display_metadata.h diff --git a/includes/ffmpeg/libavutil/mathematics.h b/ffmpeg/ffmpeg/libavutil/mathematics.h similarity index 100% rename from includes/ffmpeg/libavutil/mathematics.h rename to ffmpeg/ffmpeg/libavutil/mathematics.h diff --git a/includes/ffmpeg/libavutil/md5.h b/ffmpeg/ffmpeg/libavutil/md5.h similarity index 100% rename from includes/ffmpeg/libavutil/md5.h rename to ffmpeg/ffmpeg/libavutil/md5.h diff --git a/includes/ffmpeg/libavutil/mem.h b/ffmpeg/ffmpeg/libavutil/mem.h similarity index 100% rename from includes/ffmpeg/libavutil/mem.h rename to ffmpeg/ffmpeg/libavutil/mem.h diff --git a/includes/ffmpeg/libavutil/motion_vector.h b/ffmpeg/ffmpeg/libavutil/motion_vector.h similarity index 100% rename from includes/ffmpeg/libavutil/motion_vector.h rename to ffmpeg/ffmpeg/libavutil/motion_vector.h diff --git a/includes/ffmpeg/libavutil/murmur3.h b/ffmpeg/ffmpeg/libavutil/murmur3.h similarity index 100% rename from includes/ffmpeg/libavutil/murmur3.h rename to ffmpeg/ffmpeg/libavutil/murmur3.h diff --git a/includes/ffmpeg/libavutil/opt.h b/ffmpeg/ffmpeg/libavutil/opt.h similarity index 100% rename from includes/ffmpeg/libavutil/opt.h rename to ffmpeg/ffmpeg/libavutil/opt.h diff --git a/includes/ffmpeg/libavutil/parseutils.h b/ffmpeg/ffmpeg/libavutil/parseutils.h similarity index 100% rename from includes/ffmpeg/libavutil/parseutils.h rename to ffmpeg/ffmpeg/libavutil/parseutils.h diff --git a/includes/ffmpeg/libavutil/pixdesc.h b/ffmpeg/ffmpeg/libavutil/pixdesc.h similarity index 100% rename from includes/ffmpeg/libavutil/pixdesc.h rename to ffmpeg/ffmpeg/libavutil/pixdesc.h diff --git a/includes/ffmpeg/libavutil/pixelutils.h b/ffmpeg/ffmpeg/libavutil/pixelutils.h similarity index 100% rename from includes/ffmpeg/libavutil/pixelutils.h rename to ffmpeg/ffmpeg/libavutil/pixelutils.h diff --git a/includes/ffmpeg/libavutil/pixfmt.h b/ffmpeg/ffmpeg/libavutil/pixfmt.h similarity index 100% rename from includes/ffmpeg/libavutil/pixfmt.h rename to ffmpeg/ffmpeg/libavutil/pixfmt.h diff --git a/includes/ffmpeg/libavutil/random_seed.h b/ffmpeg/ffmpeg/libavutil/random_seed.h similarity index 100% rename from includes/ffmpeg/libavutil/random_seed.h rename to ffmpeg/ffmpeg/libavutil/random_seed.h diff --git a/includes/ffmpeg/libavutil/rational.h b/ffmpeg/ffmpeg/libavutil/rational.h similarity index 100% rename from includes/ffmpeg/libavutil/rational.h rename to ffmpeg/ffmpeg/libavutil/rational.h diff --git a/includes/ffmpeg/libavutil/rc4.h b/ffmpeg/ffmpeg/libavutil/rc4.h similarity index 100% rename from includes/ffmpeg/libavutil/rc4.h rename to ffmpeg/ffmpeg/libavutil/rc4.h diff --git a/includes/ffmpeg/libavutil/replaygain.h b/ffmpeg/ffmpeg/libavutil/replaygain.h similarity index 100% rename from includes/ffmpeg/libavutil/replaygain.h rename to ffmpeg/ffmpeg/libavutil/replaygain.h diff --git a/includes/ffmpeg/libavutil/ripemd.h b/ffmpeg/ffmpeg/libavutil/ripemd.h similarity index 100% rename from includes/ffmpeg/libavutil/ripemd.h rename to ffmpeg/ffmpeg/libavutil/ripemd.h diff --git a/includes/ffmpeg/libavutil/samplefmt.h b/ffmpeg/ffmpeg/libavutil/samplefmt.h similarity index 100% rename from includes/ffmpeg/libavutil/samplefmt.h rename to ffmpeg/ffmpeg/libavutil/samplefmt.h diff --git a/includes/ffmpeg/libavutil/sha.h b/ffmpeg/ffmpeg/libavutil/sha.h similarity index 100% rename from includes/ffmpeg/libavutil/sha.h rename to ffmpeg/ffmpeg/libavutil/sha.h diff --git a/includes/ffmpeg/libavutil/sha512.h b/ffmpeg/ffmpeg/libavutil/sha512.h similarity index 100% rename from includes/ffmpeg/libavutil/sha512.h rename to ffmpeg/ffmpeg/libavutil/sha512.h diff --git a/includes/ffmpeg/libavutil/spherical.h b/ffmpeg/ffmpeg/libavutil/spherical.h similarity index 100% rename from includes/ffmpeg/libavutil/spherical.h rename to ffmpeg/ffmpeg/libavutil/spherical.h diff --git a/includes/ffmpeg/libavutil/stereo3d.h b/ffmpeg/ffmpeg/libavutil/stereo3d.h similarity index 100% rename from includes/ffmpeg/libavutil/stereo3d.h rename to ffmpeg/ffmpeg/libavutil/stereo3d.h diff --git a/includes/ffmpeg/libavutil/tea.h b/ffmpeg/ffmpeg/libavutil/tea.h similarity index 100% rename from includes/ffmpeg/libavutil/tea.h rename to ffmpeg/ffmpeg/libavutil/tea.h diff --git a/includes/ffmpeg/libavutil/threadmessage.h b/ffmpeg/ffmpeg/libavutil/threadmessage.h similarity index 100% rename from includes/ffmpeg/libavutil/threadmessage.h rename to ffmpeg/ffmpeg/libavutil/threadmessage.h diff --git a/includes/ffmpeg/libavutil/time.h b/ffmpeg/ffmpeg/libavutil/time.h similarity index 100% rename from includes/ffmpeg/libavutil/time.h rename to ffmpeg/ffmpeg/libavutil/time.h diff --git a/includes/ffmpeg/libavutil/timecode.h b/ffmpeg/ffmpeg/libavutil/timecode.h similarity index 100% rename from includes/ffmpeg/libavutil/timecode.h rename to ffmpeg/ffmpeg/libavutil/timecode.h diff --git a/includes/ffmpeg/libavutil/timestamp.h b/ffmpeg/ffmpeg/libavutil/timestamp.h similarity index 100% rename from includes/ffmpeg/libavutil/timestamp.h rename to ffmpeg/ffmpeg/libavutil/timestamp.h diff --git a/includes/ffmpeg/libavutil/tree.h b/ffmpeg/ffmpeg/libavutil/tree.h similarity index 100% rename from includes/ffmpeg/libavutil/tree.h rename to ffmpeg/ffmpeg/libavutil/tree.h diff --git a/includes/ffmpeg/libavutil/twofish.h b/ffmpeg/ffmpeg/libavutil/twofish.h similarity index 100% rename from includes/ffmpeg/libavutil/twofish.h rename to ffmpeg/ffmpeg/libavutil/twofish.h diff --git a/includes/ffmpeg/libavutil/tx.h b/ffmpeg/ffmpeg/libavutil/tx.h similarity index 100% rename from includes/ffmpeg/libavutil/tx.h rename to ffmpeg/ffmpeg/libavutil/tx.h diff --git a/includes/ffmpeg/libavutil/uuid.h b/ffmpeg/ffmpeg/libavutil/uuid.h similarity index 100% rename from includes/ffmpeg/libavutil/uuid.h rename to ffmpeg/ffmpeg/libavutil/uuid.h diff --git a/includes/ffmpeg/libavutil/version.h b/ffmpeg/ffmpeg/libavutil/version.h similarity index 100% rename from includes/ffmpeg/libavutil/version.h rename to ffmpeg/ffmpeg/libavutil/version.h diff --git a/includes/ffmpeg/libavutil/video_enc_params.h b/ffmpeg/ffmpeg/libavutil/video_enc_params.h similarity index 100% rename from includes/ffmpeg/libavutil/video_enc_params.h rename to ffmpeg/ffmpeg/libavutil/video_enc_params.h diff --git a/includes/ffmpeg/libavutil/video_hint.h b/ffmpeg/ffmpeg/libavutil/video_hint.h similarity index 100% rename from includes/ffmpeg/libavutil/video_hint.h rename to ffmpeg/ffmpeg/libavutil/video_hint.h diff --git a/includes/ffmpeg/libavutil/xtea.h b/ffmpeg/ffmpeg/libavutil/xtea.h similarity index 100% rename from includes/ffmpeg/libavutil/xtea.h rename to ffmpeg/ffmpeg/libavutil/xtea.h diff --git a/libs/ffmpeg/avcodec-60.dll b/ffmpeg/libs/avcodec-60.dll similarity index 100% rename from libs/ffmpeg/avcodec-60.dll rename to ffmpeg/libs/avcodec-60.dll diff --git a/libs/ffmpeg/avcodec.lib b/ffmpeg/libs/avcodec.lib similarity index 100% rename from libs/ffmpeg/avcodec.lib rename to ffmpeg/libs/avcodec.lib diff --git a/libs/ffmpeg/avdevice-60.dll b/ffmpeg/libs/avdevice-60.dll similarity index 100% rename from libs/ffmpeg/avdevice-60.dll rename to ffmpeg/libs/avdevice-60.dll diff --git a/libs/ffmpeg/avdevice.lib b/ffmpeg/libs/avdevice.lib similarity index 100% rename from libs/ffmpeg/avdevice.lib rename to ffmpeg/libs/avdevice.lib diff --git a/libs/ffmpeg/avfilter-9.dll b/ffmpeg/libs/avfilter-9.dll similarity index 100% rename from libs/ffmpeg/avfilter-9.dll rename to ffmpeg/libs/avfilter-9.dll diff --git a/libs/ffmpeg/avfilter.lib b/ffmpeg/libs/avfilter.lib similarity index 100% rename from libs/ffmpeg/avfilter.lib rename to ffmpeg/libs/avfilter.lib diff --git a/libs/ffmpeg/avformat-60.dll b/ffmpeg/libs/avformat-60.dll similarity index 100% rename from libs/ffmpeg/avformat-60.dll rename to ffmpeg/libs/avformat-60.dll diff --git a/libs/ffmpeg/avformat.lib b/ffmpeg/libs/avformat.lib similarity index 100% rename from libs/ffmpeg/avformat.lib rename to ffmpeg/libs/avformat.lib diff --git a/libs/ffmpeg/avutil-58.dll b/ffmpeg/libs/avutil-58.dll similarity index 100% rename from libs/ffmpeg/avutil-58.dll rename to ffmpeg/libs/avutil-58.dll diff --git a/libs/ffmpeg/avutil.lib b/ffmpeg/libs/avutil.lib similarity index 100% rename from libs/ffmpeg/avutil.lib rename to ffmpeg/libs/avutil.lib diff --git a/libs/ffmpeg/postproc-57.dll b/ffmpeg/libs/postproc-57.dll similarity index 100% rename from libs/ffmpeg/postproc-57.dll rename to ffmpeg/libs/postproc-57.dll diff --git a/libs/ffmpeg/postproc.lib b/ffmpeg/libs/postproc.lib similarity index 100% rename from libs/ffmpeg/postproc.lib rename to ffmpeg/libs/postproc.lib diff --git a/libs/ffmpeg/swresample-4.dll b/ffmpeg/libs/swresample-4.dll similarity index 100% rename from libs/ffmpeg/swresample-4.dll rename to ffmpeg/libs/swresample-4.dll diff --git a/ffmpeg/libs/swresample.lib b/ffmpeg/libs/swresample.lib new file mode 100644 index 0000000..bb1721d Binary files /dev/null and b/ffmpeg/libs/swresample.lib differ diff --git a/ffmpeg/libs/swscale.lib b/ffmpeg/libs/swscale.lib new file mode 100644 index 0000000..5b99ad1 Binary files /dev/null and b/ffmpeg/libs/swscale.lib differ diff --git a/libs/BasicUsageEnvironment.lib b/libs/BasicUsageEnvironment.lib deleted file mode 100644 index 3e1c975..0000000 Binary files a/libs/BasicUsageEnvironment.lib and /dev/null differ diff --git a/libs/EpollTaskScheduler.lib b/libs/EpollTaskScheduler.lib deleted file mode 100644 index 85ca244..0000000 Binary files a/libs/EpollTaskScheduler.lib and /dev/null differ diff --git a/libs/UsageEnvironment.lib b/libs/UsageEnvironment.lib deleted file mode 100644 index 808e4dc..0000000 Binary files a/libs/UsageEnvironment.lib and /dev/null differ diff --git a/libs/groupsock.lib b/libs/groupsock.lib deleted file mode 100644 index 2b6cc09..0000000 Binary files a/libs/groupsock.lib and /dev/null differ diff --git a/libs/liveMedia.lib b/libs/liveMedia.lib deleted file mode 100644 index 46ba0d7..0000000 Binary files a/libs/liveMedia.lib and /dev/null differ diff --git a/src/ffmpeg-demux.cpp b/src/ffmpeg-demux.cpp index d8c6154..ad77283 100644 --- a/src/ffmpeg-demux.cpp +++ b/src/ffmpeg-demux.cpp @@ -93,7 +93,7 @@ AVIOContext *create_rtp_avio_context(int *rtp_file_index) { return avio_context; } -int decoeder() { +int main01() { populate_rtp_buffer_list(); bool have_read = false; int rtp_file_index = 0; diff --git a/src/receive.cpp b/src/receive.cpp index d367ea6..2e2b5b2 100644 --- a/src/receive.cpp +++ b/src/receive.cpp @@ -31,24 +31,23 @@ using std::shared_ptr; using std::weak_ptr; template weak_ptr make_weak_ptr(shared_ptr ptr) { return ptr; } -//std::unordered_map> peerConnectionMap; -//std::unordered_map> dataChannelMap; //shared_ptr createPeerConnection(const rtc::Configuration& config, // weak_ptr wws, std::string id); std::string localId; +std::string remoteId = "test"; std::shared_ptr track = nullptr; using nlohmann::json; int main() { try { - auto pc = std::make_shared(); rtc::Configuration config; std::string stun = "stun:stun.mcxa.cn"; config.iceServers.emplace_back(stun); localId = "qwer"; + auto pc = std::make_shared(config); auto ws = std::make_shared(); std::promise wsPromise; auto wsFuture = wsPromise.get_future(); @@ -65,7 +64,7 @@ int main() { ws->onClosed([]() { std::cout << "WebSocket closed" << std::endl; }); - ws->onMessage([&config, wws = make_weak_ptr(ws), &pc](auto data) { + ws->onMessage([&config, wws = make_weak_ptr(ws), pc](auto data) { std::cout << "Received WebSocket message" << std::endl; // data holds either std::string or rtc::binary if (!std::holds_alternative(data)) @@ -85,36 +84,9 @@ int main() { auto type = it->get(); - //std::shared_ptr pc; - //if (auto jt = peerConnectionMap.find(id); jt != peerConnectionMap.end()) { - // pc = jt->second; - //} - //else if (type == "offer") { - // std::cout << "Answering to " + id << std::endl; - // pc = createPeerConnection(config, wws, id); - //} - //else { - // return; - //} - if (type == "offer" || type == "answer") { auto sdp = message["sdp"].get(); pc->setRemoteDescription(rtc::Description(sdp, type)); - - if (type == "offer") { - pc->setLocalDescription(); - auto description = pc->localDescription(); - json message = { {"id", localId}, - {"type", description->typeString()}, - {"sdp", std::string(description.value())} }; - std::cout << message << std::endl; - wws.lock()->send(message.dump()); - } - - rtc::Description::Video v("video", rtc::Description::Direction::SendOnly); - v.addH264Codec(96); - v.addSSRC(42, "video-send"); - track = pc->addTrack(v); } else if (type == "candidate") { auto sdp = message["candidate"].get(); @@ -123,25 +95,20 @@ int main() { } }); - ws->open("ws://192.168.1.1:6210/ws/test"); + ws->open("ws://192.168.1.1:6210/ws/" + localId); wsFuture.get(); - - // ------------------------------------ - rtc::InitLogger(rtc::LogLevel::Debug); - //auto pc = std::make_shared(); - pc->onStateChange( [](rtc::PeerConnection::State state) { std::cout << "State: " << state << std::endl; }); pc->onGatheringStateChange([pc](rtc::PeerConnection::GatheringState state) { std::cout << "Gathering State: " << state << std::endl; - if (state == rtc::PeerConnection::GatheringState::Complete) { - auto description = pc->localDescription(); - json message = { {"type", description->typeString()}, - {"sdp", std::string(description.value())} }; - std::cout << message << std::endl; - } + //if (state == rtc::PeerConnection::GatheringState::Complete) { + // auto description = pc->localDescription(); + // json message = { {"type", description->typeString()}, + // {"sdp", std::string(description.value())} }; + // std::cout << message << std::endl; + //} }); SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0); @@ -165,9 +132,20 @@ int main() { // This is an RTP packet sendto(sock, reinterpret_cast(message.data()), int(message.size()), 0, reinterpret_cast(&addr), sizeof(addr)); + + byte ssrc[4]; + memcpy(ssrc, message.data() + 8, 4); + std::cout << "Received" << std::endl; }, nullptr); + pc->setLocalDescription(); + auto description = pc->localDescription(); + json message = { {"id", remoteId}, + {"type", description->typeString()}, + {"sdp", std::string(description.value())} }; + ws->send(message.dump()); + /*pc->setLocalDescription(); std::cout << "Expect RTP video traffic on localhost:5000" << std::endl; @@ -180,7 +158,6 @@ int main() { rtc::Description answer(j["sdp"].get(), j["type"].get()); pc->setRemoteDescription(answer);*/ - std::cout << "Press any key to exit." << std::endl; char dummy; std::cin >> dummy; @@ -197,8 +174,14 @@ shared_ptr createPeerConnection(const rtc::Configuration& c auto pc = std::make_shared(config); pc->onStateChange( - [](rtc::PeerConnection::State state) - { std::cout << "State: " << state << std::endl; }); + [pc](rtc::PeerConnection::State state) + { + std::cout << "State: " << state << std::endl; + rtc::Description::Video v("video", rtc::Description::Direction::SendOnly); + v.addH264Codec(96); + v.addSSRC(42, "video-send"); + track = pc->addTrack(v); + }); pc->onGatheringStateChange([](rtc::PeerConnection::GatheringState state) { std::cout << "Gathering State: " << state << std::endl; }); @@ -243,10 +226,6 @@ shared_ptr createPeerConnection(const rtc::Configuration& c std::cout << "Binary message from " << id << " received, size=" << std::get(data).size() << std::endl; }); - - //dataChannelMap.emplace(id, dc); }); - - //peerConnectionMap.emplace(id, pc); return pc; };