nRet = media_packet_new_alloc(hMediaFormat, NULL, NULL, &hMediaPacket);
PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_packet_new_alloc", WebRtcGetError(nRet),media_format_unref(hMediaFormat));
+ /* NOTE: the function below takes ownership of the packet.(no need to unref the packet, or make sure to ref/unref pair). */
nRet = webrtc_media_packet_source_push_packet(g_hWebRtcHandle, nId, hMediaPacket);
PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_push_packet", WebRtcGetError(nRet),media_packet_unref(hMediaPacket);media_format_unref(hMediaFormat));
- nRet = media_packet_unref(hMediaPacket);
- PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_packet_unref", WebRtcGetError(nRet));
-
nRet = media_format_unref(hMediaFormat);
PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_format_unref", WebRtcGetError(nRet));