ast_test_status_update(test,"Failed to write a ulaw frame to the mock channel when it should be fine\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of ulaw but it ended up on the old write callback instead of write_stream\n");
gotoend;
}
if(!pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of ulaw but it never reached the channel driver\n");
gotoend;
}
if(pvt.stream_num!=0){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the default stream but it ended up on stream %d and not 0\n",
pvt.stream_num);
gotoend;
}
pvt.wrote_stream=0;
pvt.stream_num=-1;
if(ast_write_stream(mock_channel,0,&frame)){
ast_test_status_update(test,"Failed to write a ulaw frame to the first audio stream\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the first audio stream but it ended up on the old write callback instead of write_stream\n");
gotoend;
}
if(!pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the first audio stream but it never reached the channel driver\n");
gotoend;
}
if(pvt.stream_num!=0){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the first audio stream but it ended up on stream %d and not 0\n",
pvt.stream_num);
gotoend;
}
pvt.wrote_stream=0;
pvt.stream_num=-1;
if(ast_write_stream(mock_channel,1,&frame)){
ast_test_status_update(test,"Failed to write a ulaw frame to the second audio stream\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the second audio stream but it ended up on the old write callback instead of write_stream\n");
gotoend;
}
if(!pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the second audio stream but it never reached the channel driver\n");
gotoend;
}
if(pvt.stream_num!=1){
ast_test_status_update(test,"Successfully wrote a frame of ulaw to the second audio stream but it ended up on stream %d and not 1\n",
pvt.stream_num);
gotoend;
}
pvt.wrote_stream=0;
pvt.stream_num=-1;
frame.frametype=AST_FRAME_VIDEO;
frame.subclass.format=ast_format_h264;
if(ast_write(mock_channel,&frame)){
ast_test_status_update(test,"Failed to write an h264 frame to the mock channel when it should be fine\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of h264 but it ended up on the old write callback instead of write_stream\n");
gotoend;
}
if(!pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of h264 but it never reached the channel driver\n");
gotoend;
}
if(pvt.stream_num!=2){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the default stream but it ended up on stream %d and not 2\n",
pvt.stream_num);
gotoend;
}
pvt.wrote_stream=0;
pvt.stream_num=-1;
if(ast_write_stream(mock_channel,2,&frame)){
ast_test_status_update(test,"Failed to write an h264 frame to the first video stream\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the first video stream but it ended up on the old write callback instead of write_stream\n");
gotoend;
}
if(!pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the first video stream but it never reached the channel driver\n");
gotoend;
}
if(pvt.stream_num!=2){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the first video stream but it ended up on stream %d and not 2\n",
pvt.stream_num);
gotoend;
}
pvt.wrote_stream=0;
pvt.stream_num=-1;
if(ast_write_stream(mock_channel,3,&frame)){
ast_test_status_update(test,"Failed to write an h264 frame to the second video stream\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the second video stream but it ended up on the old write callback instead of write_stream\n");
gotoend;
}
if(!pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the second video stream but it never reached the channel driver\n");
gotoend;
}
if(pvt.stream_num!=3){
ast_test_status_update(test,"Successfully wrote a frame of h264 to the second video stream but it ended up on stream %d and not 3\n",
pvt.stream_num);
gotoend;
}
pvt.wrote_stream=0;
pvt.stream_num=-1;
if(!ast_write_stream(mock_channel,9,&frame)){
ast_test_status_update(test,"Successfully wrote a frame of h264 to a non-existent stream\n");
gotoend;
}
if(pvt.wrote){
ast_test_status_update(test,"Successfully wrote a frame of h264 to a non-existent stream and it ended up on the old write callback\n");
gotoend;
}
if(pvt.wrote_stream){
ast_test_status_update(test,"Successfully wrote a frame of h264 to a non-existent stream and it ended up on the write_stream callback\n");
gotoend;
}
res=AST_TEST_PASS;
end:
ast_hangup(mock_channel);
returnres;
}
staticintunload_module(void)
{
AST_TEST_UNREGISTER(stream_create);
@ -869,6 +1284,8 @@ static int unload_module(void)