I changed the logging from tvhtrace
to tvherror
so that I could get it on the console immediately.
With the full logging that I had, TVH just froze, after I reduced the logging to the first 2 lines, it looks like the user and password pointers could contain garbage.
UPDATE:
I followed the function call tree backwards just for fun.
As we already know, the crash occurs at the very start of http_client_basic_auth
in httpc.c
.
This function was called by rtsp_send_ext
in rtsp.c
.
This is where things, in my option, get weird.
The function rtsp_send_ext
is not actually called directly, it is called via callback by streaming_target_deliver
in streaming.h
.
The callback is providing the first parameter as a streaming_target_t->st_opaque
(defined in streaming.h
) whereas rtsp_send_ext
is expecting a http_client_t
(defined in http.h
) as its first parameter. These 2 structures have a very different layout.
As st_opaque
is a *void
, I thought that maybe it could contain a pointer to a real http_client_t
set somewhere along the way. Alas, when I inspected http_client_t->hc_host
and http_client_t->hc_scheme
in rtsp_send_ext
, they both contained mush.
I added a trace before each callback to compare the function pointer to the pointer of rtsp_send_ext
and they never match. I tried to convert the function pointer to the function name with dladdr
but was unsuccessful.
The value of st_opaque
is set in streaming_target_init
in streaming.c
.
I think that I may be close, but I just can't see it yet. I'm guessing that the stream starts normally, but the act of initiating the timeshift somehow tries to modify the initial stream configuration but ends up corrupting it.